util Module

This is the util module. It is mostly just convenience functions, but, have a browse to see if they might be helpful.

Some utility functions. These are not used in the main code but are potentially useful for scripts.

SSINS.util.calc_occ(ins, mf, num_init_flag, num_int_flag=0, lump_narrowband=False)[source]

Calculates the fraction of times an event was caught by the flagger for each type of event. Does not take care of frequency broadcasted events.

Parameters:
  • ins – The flagged incoherent noise spectrum in question

  • mf – The match filter used to flag the INS

  • num_init_flag – The number of initially flagged samples

  • num_int_flag – The number of fully flagged integrations in the starting flags

  • lump_narrowband – Whether to combine narrowband occupancies into a single number. Will slightly overestimate if n_int_flag > 0.

Returns:

A dictionary with shapes for keys and occupancy fractions for values

Return type:

occ_dict

SSINS.util.combine_ins(ins1, ins2, inplace=False)[source]

This utility function combines INS for the same obs that have been averaged over different baselines.

Parameters:
  • ins1 – The first spectrum for the combination

  • ins2 – The second spectrum for the combination

  • inplace – Whether to do the operation inplace on ins1 or not.

SSINS.util.make_obsfile(obslist, outpath)[source]

Makes a text file from a list of obsids

Parameters:
  • obslist – A list of obsids

  • outpath – The filename to write to

SSINS.util.make_obslist(obsfile)[source]

Makes a python list from a text file whose lines are separated by “\n”

Parameters:

obsfile – A text file with an obsid on each line

Returns:

A list whose entries are obsids

Return type:

obslist

SSINS.util.make_ticks_labels(freqs, freq_array, sig_fig=1)[source]

Makes xticks from desired frequencies to be ticked and the freq_array.

Parameters:
  • freqs – The desired frequencies to be ticked, in Hz

  • freq_array – The frequency array that is to be ticked.

  • sig_fig – Precision of the label - number of digits after decimal point (in Mhz)

SSINS.util.write_meta(prefix, ins, uvf=None, mf=None, sep='_', clobber=False, data_compression='lzf')[source]

Wrapper around several calls to ins.write so that a standard set of metadata can be written.

Parameters:
  • prefix – The filepath prefix to write outputs to.

  • ins – The INS for which to write metadata.

  • uvf – A UVFlag object for which to generate diff-propagated flags, if desired.

  • mf – The MF (match filter) that was run on the INS object, if any.

  • sep – The separator character between the prefix and rest of output filenames.

  • clobber – Whether to overwrite existing files.

  • data_compression – The type of data compression to use for hdf5 outputs.