gaincalSNR
Return to directory of Todd's CASA extensions
Computes the per-antenna signal-to-noise ratio (SNR) expected for gaincal(solint='inf') on a per-spw basis. It recommends whether spw mapping or aggregate bandwidth (combine='spw') is needed to achieve the specified SNR.
See also
bandpassPreAverage.
Usage:
gaincalSNR(vis, tsysTable='', flux=None, field=None, intent='CALIBRATE_PHASE',
spw=None, requiredSnr=20, computeUnflaggedAntennas=False,
edgeFraction=0.03125, verbose=False, debugTsysspwmap=False,
tsysChanTol=1, atmcal=None)
Required inputs:
Optional inputs:
- tsysTable: if present, it is only used for tsysspwmap; if not present, the function will do its own mapping
- flux: the flux density value to use (default=query ALMA catalog for vis date)
- field: the field ID or name to use (default=the first PHASE calibrator)
- intent: the intent to use for the calibrator (instead of CALIBRATE_PHASE)
- spw: the spw or spw list to make predictions for (default=all with OBSERVE_TARGET intent)
- requiredSnr: threshold for which to make decisions
- computeUnflaggedAntennas: use the agentflagger tool to exclude fully flagged antennas from the sensitivity calculation
- edgeFraction: the fraction of BW to ignore on each edge of an spw
- 0.03125 corresponds to the central 1875 MHz
- tsysChanTol: only used if tsysTable is present
- atmcal: an instance of class Atmcal; if None, then run Atmcal if False, then first try the faster, less robust method
Returns: a dictionary keyed by spw ID, with the following values:
- bandwidth (Hz), aggregate_bandwidth (Hz), snr, snr_aggregate, status
Examples:
1. A dataset with two narrow windows and two wide windows, where the narrow windows require spwmap solutions
CASA <2>: au.gaincalSNR('uid___A002_X78774a_X14fc.ms')
Choosing Tsys spw 8 for spw 16
Dataset begins at 2014-01-11 11:28:53 UT. Analyzing the Atmospheric Cal scans may take a few minutes...
Found scans: [3, 6, 10, 13, 16, 19]
Information from scan 3:
Y-factors for pol [0, 1]: [1.2105671318448894, 1.2063042150016499]
Standard order of the load subscans is confirmed (sky,amb,hot)
Subscan durations: 5.76,5.76,5.76s; total=17.28s; integration=0.480s
scans = [3, 6, 10, 13, 16, 19]
times = ['11:36:10', '11:59:08', '12:15:23', '12:28:12', '12:41:02', '12:53:56']
Initialization completed in 13 seconds
Median value for spw 8 = 101.7 K
Choosing Tsys spw 10 for spw 18
Median value for spw 10 = 106.4 K
Choosing Tsys spw 12 for spw 20
Median value for spw 12 = 104.2 K
Choosing Tsys spw 14 for spw 22
Median value for spw 14 = 102.7 K
spw 16 calibrated by widest spw (22) bandwidth of 1.992188 GHz has sufficient S/N: 86.546747
spw 18 calibrated by widest spw (22) bandwidth of 1.992188 GHz has sufficient S/N: 83.094521
spw 20 calibrated by spw 20 has sufficient S/N: 82.367406
spw 22 calibrated by spw 22 has sufficient S/N: 83.176789
Out[2]:
{16: {'bandwidth': 62500000.0,
'calibrator_flux_density': 0.63093556173663468,
'meanFreq': 309937163074.9063,
'medianTsys': 101.74509811401367,
'snr': 15.329417434150491,
'snr_aggregate': 119.70889105656292,
'status': 'spwmap',
'widest_spw_bandwidth': 1992187500.0},
18: {'bandwidth': 62500000.0,
'calibrator_flux_density': 0.63329902075484401,
'meanFreq': 308449847086.3361,
'medianTsys': 106.36914443969727,
'snr': 14.717948857457451,
'snr_aggregate': 114.93387429246924,
'status': 'spwmap',
'widest_spw_bandwidth': 1992187500.0},
20: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.63392579797432114,
'meanFreq': 308057545008.604,
'medianTsys': 104.20721817016602,
'snr': 82.367406190789183,
'snr_aggregate': 117.43445040890175,
'status': 'normal',
'widest_spw_bandwidth': 1992187500.0},
22: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.63102965386153442,
'meanFreq': 309877707758.7102,
'medianTsys': 102.72174453735352,
'snr': 83.176788577541544,
'snr_aggregate': 118.58841870964859,
'snr_widest_spw': 85.736671226218064,
'status': 'normal',
'widest_spw_bandwidth': 1992187500.0},
'aggregate_bandwidth': 3811373687.6082153}
Example 2. A bandwidth-switching project
CASA <2>: au.gaincalSNR('uid___A002_X775008_X3d9.ms')
Choosing Tsys spw 9 for spw 17
Dataset begins at 2013-12-27 02:19:40 UT. Analyzing the Atmospheric Cal scans may take a few minutes...
Found scans: [2, 5, 8, 11, 20, 29]
Information from scan 2:
Y-factors for pol [0, 1]: [1.210986141867747, 1.2125418798252843]
Standard order of the load subscans is confirmed (sky,amb,hot)
Subscan durations: 3.89,3.98,4.08s; total=11.95s; integration=0.480s
scans = [2, 5, 8, 11, 20, 29]
times = ['02:23:46', '02:26:54', '02:34:50', '02:40:29', '03:02:53', '03:25:19']
Initialization completed in 59 seconds
Median value for spw 9 = 60.6 K
Choosing Tsys spw 11 for spw 19
Median value for spw 11 = 59.4 K
Choosing Tsys spw 13 for spw 21
Median value for spw 13 = 63.2 K
Choosing Tsys spw 15 for spw 23
Median value for spw 15 = 66.9 K
This is a bandwidth switching project (spw 33 matched to spw 17)
This is a bandwidth switching project (spw 35 matched to spw 19)
This is a bandwidth switching project (spw 37 matched to spw 21)
This is a bandwidth switching project (spw 39 matched to spw 23)
spw 33 calibrated by spw 17 has sufficient S/N: 94.484199
spw 35 calibrated by spw 19 has sufficient S/N: 94.905946
spw 37 calibrated by spw 21 has sufficient S/N: 82.620468
spw 39 calibrated by spw 23 has sufficient S/N: 76.963626
Out[2]:
{17: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.13806454806939403,
'meanFreq': 86576640251.81187,
'medianTsys': 60.566562652587891,
'snr': 94.484199397205131,
'snr_aggregate': 194.01880388851905,
'status': 'normal_bw_switching'},
19: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.13594205373341273,
'meanFreq': 88514140251.81189,
'medianTsys': 59.370450019836426,
'snr': 94.905946429015074,
'snr_aggregate': 194.8848413336934,
'status': 'normal_bw_switching'},
21: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.12607264863269158,
'meanFreq': 98576640251.81195,
'medianTsys': 63.247470855712891,
'snr': 82.620468230569855,
'snr_aggregate': 169.65719691835289,
'status': 'normal_bw_switching'},
23: {'bandwidth': 1875000000.0,
'calibrator_flux_density': 0.1243124708611016,
'meanFreq': 100576640251.81197,
'medianTsys': 66.948232650756836,
'snr': 76.963626012563509,
'snr_aggregate': 158.04114081663676,
'status': 'normal_bw_switching'},
'aggregate_bandwidth': 7500000000.0}
--
ToddHunter - 2014-09-18