pipeline.hifa.heuristics package

Submodules

pipeline.hifa.heuristics.atm module

class pipeline.hifa.heuristics.atm.AtmHeuristics(context, vis)[source]

Bases: object

spwid_rank_by_frequency()[source]

Return the spw id of the science spw with highest centre frequency.

spwid_rank_by_opacity()[source]
spwid_rank_by_opacity_and_bandwidth()[source]
spwid_rank_by_tsys_and_bandwidth(intent)[source]

pipeline.hifa.heuristics.exptimes module

Compute the mean per spectral window per scan exposure and integration times for the selected data

pipeline.hifa.heuristics.exptimes.get_scan_exptimes(ms, fieldnamelist, intent, spwidlist)[source]
Input Parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwidlist: The list of spw ids to be selected

pipeline.hifa.heuristics.fluxscale module

pipeline.hifa.heuristics.fluxscale.antenna(ms, refsource, refant, peak_frac=0.7)[source]

Finds the size of the reference object and the baseline length at which its Fourier transform drops to 80% of peak. Then find antennas within this distance of the reference antenna and return them as a list, such that gaincals will only use baselines between them. refsource – Name of reference source. refant – Name of reference antenna. peak_frac – Fraction of refsource peak visibility at which to set

uv distance limit for antennas.

pipeline.hifa.heuristics.imageprecheck module

class pipeline.hifa.heuristics.imageprecheck.ImagePreCheckHeuristics(inputs)[source]

Bases: object

compare_beams(beam_0p0, beam_0p5, beam_1p0, beam_2p0, minAR, maxAR, maxBR)[source]

pipeline.hifa.heuristics.phasespwmap module

pipeline.hifa.heuristics.phasespwmap.combine_spwmap(scispws)[source]

Returns a spectral window map where each science spectral window is mapped to the lowest science spectral window ID that matches its Spectral Spec.

Parameters

scispws – list of spectral window objects for science spectral windows

Returns

spectral window map

pipeline.hifa.heuristics.phasespwmap.get_spectral_spec(spw)[source]

Extract spectral spec from spectral window name.

pipeline.hifa.heuristics.phasespwmap.get_spspec_to_spwid_map(spws)[source]

Returns a dictionary of spectral specs and their corresponding science spectral window ids.

Parameters

spws – list of spectral window objects for science spectral windows

Returns

dictionary with spectral spec as keys, and corresponding

spectral windows as values.

pipeline.hifa.heuristics.phasespwmap.simple_n2wspwmap(allspws, scispws, maxnarrowbw, maxbwfrac, samebb)[source]
pipeline.hifa.heuristics.phasespwmap.snr_n2wspwmap(allspws, scispws, snrs, goodsnrs)[source]

pipeline.hifa.heuristics.snr module

pipeline.hifa.heuristics.snr.LOG = <Logger pipeline.hifa.heuristics.snr (INFO)>

The ALMA receiver band, nominal tsys, and sensitivity info. This information should go elsewhere in the next release The ALMA receiver bands are defined per pipeline convention

pipeline.hifa.heuristics.snr.compute_bpsolint(ms, spwlist, spw_dict, reqPhaseupSnr, minBpNintervals, reqBpSnr, minBpNchan, evenbpsolints=False)[source]

Compute the optimal bandpass frequency solution intervals given the spw list and the spw dictionary.

The input parameters

spwlist The list of spw ids spw_dict The spw dictionary reqPhaseupSnr The requested phaseup SNR minBpNintervals The minimum number of phase up time intervals, e.g. 2 reqBpSnr The requested bandpass SNR minBpNchan The minimum number of bandpass channel solutions, e.g. 8

The output solution interval dictionary.

The bandpass preaveraging dictionary keys and values

key: the spw id value: The science spw id as an integer

The preaveraging parameter dictionary keys and values

key: ‘band’ value: The ALMA receiver band key: ‘frequency_Hz’ value: The frequency of the spw key: ‘nchan_total’ value: The total number of channels key: ‘chanwidth_Hz’ value: The median channel width in Hz

key: ‘tsys_spw’ value: The tsys spw id as an integer key: ‘median_tsys’ value: The median tsys value

key: ‘flux_Jy’ value: The flux of the source in Jy key: ‘exptime_minutes’ value: The exposure time in minutes key: ‘snr_per_channel’ value: The signal to noise per channel key: ‘sensitivity_per_channel_mJy’ value: The sensitivity in mJy per channel

key: ‘bpsolint’ value: The frequency solint in MHz key: ‘nchan_bpsolint’ value: The total number of solint channels

pipeline.hifa.heuristics.snr.compute_gaincalsnr(ms, spwlist, spw_dict, edge_fraction)[source]

Compute the gain to signal to noise given the spw list and the spw dictionary.

This code assumes that the science spws are observed in both the calibrator and the science target.

The input parameters

spwlist The list of spw ids spw_dict The spw dictionary edge_fraction Fraction of the edge that is flagged

The output SNR dictionary.

The SNR dictionary keys and values

key: the spw id value: The science spw id as an integer

The preaveraging parameter dictionary keys abd values

key: ‘band’ value: The ALMA receiver band key: ‘frequency_Hz’ value: The frequency of the spw key: ‘nchan_total’ value: The total number of channels key: ‘chanwidth_Hz’ value: The median channel width in Hz

key: ‘tsys_spw’ value: The tsys spw id as an integer key: ‘median_tsys’ value: The median tsys value

key: ‘flux_Jy’ value: The flux of the source in Jy key: ‘scantime_minutes’ value: The exposure time in minutes key: ‘inttime_minutes’ value: The exposure time in minutes key: ‘sensitivity_per_scan_mJy value: The sensitivity per scan in mJy key: ‘snr_per_scan value: The snr per scan

pipeline.hifa.heuristics.snr.estimate_bpsolint(ms, fieldlist, intent, spwidlist, compute_nantennas, max_fracflagged, phaseupsnr, minphaseupints, bpsnr, minbpnchan, evenbpsolints=False)[source]

Estimate the optimal solint for the selected bandpass data and return the solution in the form of a dictionary.

Input Parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwidlist: The list of spw ids to be selected

compute_nantennas: The algorithm for computing the number of unflagged antennas (‘all’, ‘flagged’)
max_fracflagged: The maximum fraction of an antenna can be flagged, e.g. 0.90

phaseupsnr: The desired phaseup gain solution SNR, e.g. 20.0

minphaseupints: The minimum number of phaseup solution intervals, e.g. 2

bpsnr: The desired bandpass solution SNR, e.g. 50.0

minbpnchan: The minimum number of bandpass solution intervals, e.g. 8

The output solution interval dictionary

The bandpass preaveraging dictionary keys and values

key: the spw id value: The science spw id as an integer

The preaveraging parameter dictionary keys and values

key: ‘band’ value: The ALMA receiver band key: ‘frequency_Hz’ value: The frequency of the spw key: ‘nchan_total’ value: The total number of channels key: ‘chanwidth_Hz’ value: The median channel width in Hz

key: ‘tsys_spw’ value: The tsys spw id as an integer key: ‘median_tsys’ value: The median tsys value

key: ‘flux_Jy’ value: The flux of the source in Jy key: ‘exptime_minutes’ value: The exposure time in minutes key: ‘snr_per_channel’ value: The signal to noise per channel key: ‘sensitivity_per_channel_mJy’ value: The sensitivity in mJy per channel

key: ‘bpsolint’ value: The frequency solint in MHz

pipeline.hifa.heuristics.snr.estimate_gaincalsnr(ms, fieldlist, intent, spwidlist, compute_nantennas, max_fracflagged, edge_fraction)[source]

Estimate the signal to noise of the phase measurements and return it in the form of a dictionary.

Input Parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwidlist: The list of spw ids to be selected

compute_nantennas: The algorithm for computing the number of unflagged antennas (‘all’, ‘flagged’)

max_fracflagged: The maximum fraction of an antenna can be flagged, e.g. 0.90

The output SNR dictionary

The SNR dictionary keys and values

key: the spw id value: The science spw id as an integer

The SNR dictionary keys and values

TBD

pipeline.hifa.heuristics.snr.get_fluxinfo(ms, fieldnamelist, intent, spwidlist)[source]

Retrieve the fluxes of selected sources from the pipeline context as a function of spw id and return the results in a dictinary indexed by spw id.

The input parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwlist: The list of spw ids to be selected

The output flux dictionary fluxdict

The flux dictionary key and value

key: The spw id value: The source flux dictionary

The source flux dictionary keys and values

key: ‘field_name’ value: The name of the source, e.g. ‘3C286’ key: ‘flux’ value: The flux of the source in Jy, e.g. 1.53

pipeline.hifa.heuristics.snr.get_mediantemp(ms, tsys_spwlist, scan_list, antenna='', temptype='tsys')[source]

Get median Tsys, Trx, or Tsky temperatures as a function of spw and return a dictionary

Input parameters

ms: The pipeline measurement set object

tsys_spwlist: The list of Tsys spw ids, e.g. [9,11,13,15]
scan_list: The list of associated observation scan numbers, e.g. [4,8]

antenna: The antenna selectionm ‘’ for all antennas, or a single antenna id or name

temptype: The temperature type ‘tsys’ (default), ‘trx’ or ‘tsky’

The output dictionary

The median temperature dictionary keys and values

key: the spw id value: The median Tsys temperature in degrees K

pipeline.hifa.heuristics.snr.get_obsinfo(ms, fieldnamelist, intent, spwidlist, compute_nantennas='all', max_fracflagged=0.9)[source]

Get the observing information as a function of spw id and return a dictionary.

Input parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwidlist: The list of spw ids to be selected

compute_nantennas: The algorithm for computing the number of unflagged antennas (‘all’, ‘flagged’)

(was ‘hm_nantennas’)

max_fracflagged: The maximum fraction of an antenna can be flagged

The output observing dictionary obsdict

The observing dictionary key and value

key: the spw id value: The observing scans dictionary

The observing scans dictionary keys and values

key: ‘snr_scans’ value: The list of snr source scans, e.g. [4,8] key: ‘num_12mantenna’ value: The max number of 12m antennas, e.g. 32 key: ‘num_7mantenna’ value: The max number of 7m antennas, e.g. 7 key: ‘exptime’ value: The exposure time in minutes, e.g. 6.32 key: ‘integrationtime’ value: The mean integration time in minutes, e.g. 0.016 key: ‘band’ value: The ALMA receiver band, e.g. ‘ALMA Band 3’ key: ‘bandcenter’ value: The receiver band center frequency in Hz, e.g. 9.6e9 key: ‘bandwidth’ value: The band width in Hz, e.g. 2.0e9 key: ‘nchan’ value: The number of channels, e.g. 28 key: ‘chanwidths’ value: The median channel width in Hz, e.g. 7.3e7

pipeline.hifa.heuristics.snr.get_tsysinfo(ms, fieldnamelist, intent, spwidlist)[source]

Get the tsys information as functions of spw and return a dictionary.

Input parameters

ms: The pipeline context ms object

fieldnamelist: The list of field names to be selected

intent: The intent of the fields to be selected

spwidlist: The list of spw ids to be selected

The output dictionary

The tsys dictionary tsysdict keys and values

key: The spw id value: The Tsys source dictionary

The tsys source dictionary keys and values

key: ‘tsys_field_name’ value: The name of the Tsys field source, e.g. ‘3C286’ (was ‘atm_field_name’) key: ‘intent’ value: The intent of the selected source, e.g. ‘BANDPASS’ key: ‘snr_scan’ value: The scan associated with Tsys used to compute the SNR, e.g. 4 key: ‘tsys_scan’ value: The Tsys scan to be used for Tsys computation, e.g. 3 key: ‘tsys_spw’ value: The Tsys spw associated with the science spw id, e.g. 13

pipeline.hifa.heuristics.snr.join_dicts(spwlist, tsys_dict, flux_dict, tsystemp_dict, obs_dict)[source]

Combine all the input dictionaries and output the spw dictionary. This dictionary contains all the information needed to compute the SNR estimates.

The input parameters

The output dictionary spw_dict

The spw dictionary spw_dict key and value

key: The spw id value: The spw source dictionary

The spw source dictionary keys and values

key: ‘tsys_field_name’ value: The name of the Tsys field source, e.g. ‘3C286’ key: ‘intent’ value: The intent of the field source, e.g. ‘BANDPASS’ key: ‘snr_scan’ value: The scan associated with Tsys used to compute the SNR, e.g. 4 key: ‘tsys_scan’ value: The Tsys scan to be used for Tsys computation, e.g. 3 key: ‘tsys_spw’ value: The Tsys spw associated with the science spw id, e.g. 13

key: ‘field_name’ value: The name of the field source, e.g. ‘3C286’ key: ‘flux’ value: The flux of the field source in Jy, e.g. 5.305

key: ‘median_tsys’ value: The median Tsys value in degrees K, e.g. 45.5

key: ‘snr_scans’ value: The list of snr source scans, e.g. [4,8] key: ‘num_12mantenna’ value: The max number of 12m antennas, e.g. 32 key: ‘num_7mantenna’ value: The max number of 7m antennas, e.g. 7 key: ‘exptime’ value: The exposure time in minutes, e.g. 6.32 key: ‘integrationtime’ value: The mean integration time in minutes, e.g. 0.016 key: ‘band’ value: The ALMA receiver band, e.g. ‘ALMA Band 3’ key: ‘bandcenter’ value: The receiver band center frequency in Hz, e.g. 9.6e9 key: ‘bandwidth’ value: The band width in Hz, e.g. 2.0e9 key: ‘nchan’ value: The number of channels, e.g. 28 key: ‘chanwidths’ value: The median channel width in Hz, e.g. 7.3e7

pipeline.hifa.heuristics.snr.make_tsyslists(spwlist, tsysdict)[source]

Utility routine for constructing the tsys spw list and the observing scan list from the tysdict produced by get_tsysinfo.

Input Parameters

spwlist: The science spw list, e.g. [13, 15]

tsysdict: The Tsys dictionary created by get_tsysinfo

Returned values
tsys_spwlist: The Tsys spw id list corresponding to spwlist

scanlist: The list of snr scans for each Tsys window

pipeline.hifa.heuristics.snr.nextHighestDivisibleInt(n, d)[source]

Checks whether an integer is evenly divisible by a second integer, and if not, finds the next higher integer that is.

n: larger integer d: smaller integer

pipeline.hifa.heuristics.wvrgcal module

class pipeline.hifa.heuristics.wvrgcal.WvrgcalHeuristics(context, vis, hm_tie, tie, hm_smooth, smooth, sourceflag, nsol, segsource)[source]

Bases: object

nsol()[source]
segsource()[source]
smooth(spw)[source]
smoothall(allspws)[source]
sourceflag()[source]
tie()[source]
toffset()[source]
wvr_available()[source]

Module contents