Coverage for / home / casatest / venv / lib / python3.12 / site-packages / casatasks / pccor.py: 56%
27 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 07:14 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 07:14 +0000
1##################### generated by xml-casa (v2) from pccor.xml #####################
2##################### de35fe7266939842b00df275605acd0d ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_pccor import pccor as _pccor_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _pccor:
15 """
16 pccor ---- Generate Pulse Cal CORrections (pccor) for VLBA data
19 PCCOR produces time resolved phase and delay corrections for VLBA data by analysing the phases in the
20 PHASE_CAL table inside a VLBA MS. Delay corrections are estimated from the highest and lowest frequency
21 tones within each SPW which leads to cycle ambiguities. Cycle ambiguities are dealt with by comparing the
22 PC delay correction over a selected time range and/or scan with a reference fringe fit delay solution over
23 the same time range obtained from a better spectra leverage. The reference fringe fit table can be produced
24 by an internal PCCOR call to fringefit or can be provided by an expert user as input.
26 When pulse cal data is completely missing for an antenna and/or spectral window pccor does not flag that
27 data, it simply throws a warning and does not produce solutions for that antenna and/or spectral window.
28 When pulse cal data is missing during the selected time range for the fringe fit solution a warning is
29 thrown indicating that this is the case, which the user my go around by selecting another fringe fit time
30 range. Lastly in the case that pulse cal data is missing for the reference antenna during the fringe fit
31 time range for a spectral window, no solutions will be produced for that spectral window, if all selected
32 spectral windows have missing pulse cal data for the reference antenna an error/exception is thrown.
35 --------- parameter descriptions ---------------------------------------------
37 vis Name of input visibility file (MS)
38 pccor_caltable Name of output gain calibration table
39 refant Reference antenna name
40 timerange Time range over which to compare fringefit and pccor delays. The selected time range must have a
41 bright high SNR source but must not be long enough to break coherence, usually a few minutes.
42 If both a time range and a scan are specified pccor will check if they are compatible, if not, an
43 Exception is thrown, if neither a scan nor a time range are specified pccor will also throw an
44 exception, as time selection is required for the execution of pccor.
45 scan Select a time range over which to compare fringefit and pccor delays based on a scan. The selected
46 scan must have a bright, high SNR source, but must not be long enough to break coherence, usually a
47 few minutes. If both a time range and a scan are specified pccor will check if they are compatible,
48 if not, an Exception is thrown, if neither a scan nor a time range are specified pccor will also
49 throw an exception, as time selection is required for the execution of pccor.
50 spw Select the spectral windows for which to compute pccor solutions. If parameter is not specified, all
51 available spectral windows are selected.
52 antenna Select the antennas for which to compute pccor solutions. If parameter is not specified, all
53 available antennas are selected. PCCOR is based on antenna based data, and hence no baseline
54 selection is allowed here.
55 cablecal_correction Add cable delay to pulse cal delays?
56 Default: False
57 Options: False|True
58 ff_table Optional reference Fringe fit table. This option is for the user that wants to have fine control
59 over the fringe fit solution being used to deal with cycle ambiguities. If no such control is needed
60 or desired this parameter can be left blank and pccor will produce the reference fringe fit table.
61 fallback_to_fringefit Fallback to using the fringefit solution when pulse cal data is missing, either completely or
62 during the fringe fit solution interval, for an antenna and SPW combination. When True PCCOR will
63 use the results of the reference fringe solution for the antenna and SPW combinations that are
64 missing pulse cal data. When False PCCOR will not produce solutions for the antenna and SPW
65 combinations that are missing pulse cal data.
66 Default is: True.
68 --------- examples -----------------------------------------------------------
71 Example of a pccor call using a scan to select a time range:
72 pccor(
73 vis='my_vlba_data.ms',
74 pccor_caltable='my_vlba_data.ms.pccor',
75 refant='LA',
76 scan='15'
77 )
79 Example of a pccor call using a time range directly:
80 pccor(
81 vis='my_vlba_data.ms',
82 pccor_caltable='my_vlba_data.ms.pccor',
83 refant='LA',
84 timerange='2011/09/16/21:36:00~21:37:00'
85 )
87 Example of a pccor call with spectral window selection and MK antenna exclusion:
88 pccor(
89 vis='my_vlba_data.ms',
90 pccor_caltable='my_vlba_data.ms.pccor',
91 refant='LA',
92 timerange='2011/09/16/21:36:00~21:37:00',
93 spw='0,1,2',
94 antenna='!MK'
95 )
97 Lastly an example of a pccor call where the user provides a reference frige fit cal table.
98 pccor(
99 vis='my_vlba_data.ms',
100 pccor_caltable='my_vlba_data.ms.pccor',
101 refant='LA',
102 timerange='2011/09/16/21:36:00~21:37:00',
103 ff_table='my_previous_ref_fringefit.mpc'
104 )
108 """
110 _info_group_ = """calibration"""
111 _info_desc_ = """Generate Pulse Cal CORrections (pccor) for VLBA data"""
113 def __call__( self, vis='', pccor_caltable='', refant='', timerange='none', scan='none', spw='none', antenna='none', cablecal_correction=False, ff_table='none', fallback_to_fringefit=True ):
114 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'pccor_caltable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'cablecal_correction': {'type': 'cBool'}, 'ff_table': {'type': 'cStr', 'coerce': _coerce.to_str}, 'fallback_to_fringefit': {'type': 'cBool'}}
115 doc = {'vis': vis, 'pccor_caltable': pccor_caltable, 'refant': refant, 'timerange': timerange, 'scan': scan, 'spw': spw, 'antenna': antenna, 'cablecal_correction': cablecal_correction, 'ff_table': ff_table, 'fallback_to_fringefit': fallback_to_fringefit}
116 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
117 _logging_state_ = _start_log( 'pccor', [ 'vis=' + repr(_pc.document['vis']), 'pccor_caltable=' + repr(_pc.document['pccor_caltable']), 'refant=' + repr(_pc.document['refant']), 'timerange=' + repr(_pc.document['timerange']), 'scan=' + repr(_pc.document['scan']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'cablecal_correction=' + repr(_pc.document['cablecal_correction']), 'ff_table=' + repr(_pc.document['ff_table']), 'fallback_to_fringefit=' + repr(_pc.document['fallback_to_fringefit']) ] )
118 task_result = None
119 try:
120 task_result = _pccor_t( _pc.document['vis'], _pc.document['pccor_caltable'], _pc.document['refant'], _pc.document['timerange'], _pc.document['scan'], _pc.document['spw'], _pc.document['antenna'], _pc.document['cablecal_correction'], _pc.document['ff_table'], _pc.document['fallback_to_fringefit'] )
121 except Exception as exc:
122 _except_log('pccor', exc)
123 raise
124 finally:
125 task_result = _end_log( _logging_state_, 'pccor', task_result )
126 return task_result
128pccor = _pccor( )