SS Class

This is the sky_subtract class. It is a subclass of UVData with only a few extra methods. This is mostly a precursor to the INS class.

class SSINS.SS[source]

Defines the SS class.

MLE

Array of length Nfreqs that stores maximum likelihood estimators for each frequency, calculated using the MLE_calc method

MLE_calc()[source]

Calculates maximum likelihood estimators for Rayleigh fits at each frequency. Used for developing a mixture fit.

apply_flags(flag_choice=None, INS=None, custom=None)[source]

A function which applies flags to the data via numpy masked arrays. Also changes the SS.flag_choice attribute.

Parameters
  • flag_choice (None, 'original', 'INS', 'custom') – Applies flags according to the choice. None unflags the data. ‘original’ applies flags based on the flag_array attribute. ‘INS’ applies flags from an INS object specified by the INS keyword. ‘custom’ applies a custom flag array specified by the custom keyword - it must be the same shape as the data.

  • INS – An INS from which to apply flags - only used if flag_choice=’INS’

  • custom – A custom flag array from which to apply flags - only used if flag_choice=’custom’

diff(flag_choice=None, INS=None, custom=None)[source]

Differences the visibilities in time. Does so independently for each baseline, so different integration times or sets of time centers are supported. The flags are propagated by taking the boolean OR of the entries that correspond to the visibilities that are differenced from one another. Other metadata attributes are also adjusted so that the resulting SS object passes UVData.check(). Will then call self.apply_flags using the keyword arguments.

Parameters
  • flag_choice (None, 'original', 'INS', 'custom') – Applies flags according to the choice. None unflags the data. ‘original’ applies flags based on the flag_array attribute. ‘INS’ applies flags from an INS object specified by the INS keyword. ‘custom’ applies a custom flag array specified by the custom keyword - it must be the same shape as the data.

  • INS – An INS from which to apply flags - only used if flag_choice=’INS’

  • custom – A custom flag array from which to apply flags - only used if flag_choice=’custom’

mixture_prob(bins)[source]

Calculates the probabilities of landing in each bin for a given set of bins.

Parameters

bins – The bin edges of the bins to calculate the probabilities for.

Returns

The probability to land in each bin based on the maximum likelihood model

Return type

prob

read(filename, diff=False, flag_choice=None, INS=None, custom=None, **kwargs)[source]

Reads in a file that is compatible with UVData object by first calling UVData.read(). See UVData documentation for list of kwargs that can be passed to UVData.read()

Parameters
  • filename (str or list of str) – The filepath(s) to read in.

  • diff (bool) – If True, and data was read in, then difference the visibilities in time

  • flag_choice – Sets flags for the data array on read using apply_flags method.

  • INS – An INS object for apply_flags()

  • custom – A custom flag array for apply_flags()

  • kwargs – Additional kwargs are passed to UVData.read()

rev_ind(band)[source]

Reverse indexes sky-subtracted visibilities whose amplitudes are within a band given by the band argument. Collapses along the baselines to return a time-frequency waterfall per polarization. For example, setting a band of [1e3, 1e4] reports the number of baselines at each time/frequency/polarization whose sky-subtracted visibility amplitude was between 1e3 and 1e4. Includes flags.

Parameters

band – The minimum and maximum amplitudes to be sought

Returns

A time-frequency waterfall per polarization counting the number of baselines whose sky-subtracted visibility amplitude fell within the band argument.

Return type

rev_ind_hist

write(filename_out, file_type_out, UV=None, filename_in=None, read_kwargs={}, combine=True, nsample_default=1, write_kwargs={})[source]

Lets one write out the flags to a new file. This requires extending the flags in time. The same convention is used as in INS.flags_to_mask(). The rest of the data for writing the file is pulled from an existing UVData object passed using the UV keyword, or read in to a new UVData object using the filename_in keyword. Due to how the nsample_array and flag_array get combined into the weights when writing uvfits, areas where the nsample_array == 0 are set to nsample_default so that new flags can actually be propagated to those data in the new uvfits file.

Parameters
  • filename_out – The name of the file to write to. Required

  • file_type_out – The typle of file to write out. See pyuvdata documentation for options. Required

  • UV – A UVData object whose data and metadata to use to write the file.

  • filename_in – A file from which to read data in order to write the new file. Not used if UV is not None.

  • read_kwargs – A keyword dictionary for the UVData read method if reading from a file. See pyuvdata documentation for read keywords.

  • combine (bool) – If True, combine the original flags with the new flags (OR them), else just use the new flags.

  • nsample_default – Used for writing uvfits when elements of the nsample_array are 0. This is necessary due to the way the nsample_array and flag_array are combined into the weights when writing uvfits, otherwise flags do not actually get propagated to the new file where nsample_array is 0.

  • write_kwargs – A keyword dictionary for the selected UVData write method. See pyuvdata documentation for write keywords.