Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/sdpolaverage.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 18:48 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 18:48 +0000
1##################### generated by xml-casa (v2) from sdpolaverage.xml ##############
2##################### 6ce0e4d70928a41ecc113cd78a7d2fa9 ##############################
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_sdpolaverage import sdpolaverage as _sdpolaverage_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 _sdpolaverage:
15 """
16 sdpolaverage ---- Average SD spectra over polarisation
20 The task sdpolaverage exports data averaged over different polarisations.
21 Scope of this task is to obtain Stokes I from orthogonal autocorrelation
22 pairs (XXYY/LLRR). Available options include:
24 * '' (blank string as the default: polarisation averaging turned off)
25 * stokes
26 * geometric
28 --------- parameter descriptions ---------------------------------------------
30 infile name of input SD dataset
31 datacolumn name of data column to be used ["data", "float_data", or "corrected_data"]
32 antenna select data by antenna name or ID, e.g. "PM03"
33 field select data by field IDs and names, e.g. "3C2*" (""=all)
34 spw select data by IF IDs (spectral windows), e.g. "3,5,7" (""=all)
35 timerange select data by time range, e.g. "09:14:0~09:54:0" (""=all) (see examples in help)
36 scan select data by scan numbers, e.g. "21~23" (""=all)
37 intent select data by observational intent, e.g. "*ON_SOURCE*" (""=all)
38 polaverage polarization averaging mode ("", "stokes" or "geometric").
39 outfile name of output file
41 --------- examples -----------------------------------------------------------
44 -----------------
45 Keyword arguments
46 -----------------
47 infile -- name of input SD dataset
48 datacolumn -- name of data column to be used
49 options: 'data', 'float_data', or 'corrected_data'
50 default: 'data'
51 antenna -- select data by antenna name or ID
52 default: '' (use all antennas)
53 example: 'PM03'
54 field -- select data by field IDs and names
55 default: '' (use all fields)
56 example: field='3C2*' (all names starting with 3C2)
57 field='0,4,5~7' (field IDs 0,4,5,6,7)
58 field='0,3C273' (field ID 0 or field named 3C273)
59 this selection is in addition to the other selections to data
60 spw -- select data by IF IDs (spectral windows)/channels
61 default: '' (use all IFs and channels)
62 example: spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
63 spw='<2'; spectral windows less than 2 (i.e. 0,1)
64 spw='0:5~61'; spw 0, channels 5 to 61
65 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3 - chans 3 to 45.
66 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
67 spw = '*:3~64' channels 3 through 64 for all sp id's
68 spw = ' :3~64' will NOT work.
70 NOTE: sdpolaverage does not support multiple channel ranges
71 per spectral window (';') just like mstransform doesn't.
72 this selection is in addition to the other selections to data
73 timerange -- select data by time range
74 default: '' (use all)
75 example: timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
76 Note: YYYY/MM/DD can be dropped as needed:
77 timerange='09:14:00~09:54:00' # this time range
78 timerange='09:44:00' # data within one integration of time
79 timerange='>10:24:00' # data after this time
80 timerange='09:44:00+00:13:00' #data 13 minutes after time
81 this selection is in addition to the other selections to data
82 scan -- select data by scan numbers
83 default: '' (use all scans)
84 example: scan='21~23' (scan IDs 21,22,23)
85 this selection is in addition to the other selections to data
86 intent -- select data by observational intent, also referred to as 'scan intent'
87 default: '' (use all scan intents)
88 example: intent='*ON_SOURCE*' (any valid scan-intent expression accepted by the MSSelection module can be specified)
89 this selection is in addition to the other selections to data
90 polaverage -- polarization averaging mode
91 default: '' (no averaging over polarization)
92 options: '', 'stokes', 'geometric'
93 outfile -- name of output file
96 -------
97 POLARIZATION AVERAGE
98 -------
99 Two modes of polarization averaging are available. The default is
100 'stokes' which is an average based on a formulation of Stokes
101 parameter. In this mode, averaged data is calculated by
102 (XX + YY) / 2 or (RR + LL) / 2. Other option is 'geometric', which
103 is a conventional way of averaging in the field of single-dish
104 data reduction. The averaged data is given by weighted average
105 of XX and YY, or RR and LL.
108 """
110 _info_group_ = """single dish"""
111 _info_desc_ = """Average SD spectra over polarisation"""
113 def __call__( self, infile='', datacolumn='data', antenna='', field='', spw='', timerange='', scan='', intent='', polaverage='', outfile='' ):
114 schema = {'infile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'polaverage': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'stokes', 'geometric' ]}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}}
115 doc = {'infile': infile, 'datacolumn': datacolumn, 'antenna': antenna, 'field': field, 'spw': spw, 'timerange': timerange, 'scan': scan, 'intent': intent, 'polaverage': polaverage, 'outfile': outfile}
116 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
117 _logging_state_ = _start_log( 'sdpolaverage', [ 'infile=' + repr(_pc.document['infile']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'antenna=' + repr(_pc.document['antenna']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'timerange=' + repr(_pc.document['timerange']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'polaverage=' + repr(_pc.document['polaverage']), 'outfile=' + repr(_pc.document['outfile']) ] )
118 task_result = None
119 try:
120 task_result = _sdpolaverage_t( _pc.document['infile'], _pc.document['datacolumn'], _pc.document['antenna'], _pc.document['field'], _pc.document['spw'], _pc.document['timerange'], _pc.document['scan'], _pc.document['intent'], _pc.document['polaverage'], _pc.document['outfile'] )
121 except Exception as exc:
122 _except_log('sdpolaverage', exc)
123 raise
124 finally:
125 task_result = _end_log( _logging_state_, 'sdpolaverage', task_result )
126 return task_result
128sdpolaverage = _sdpolaverage( )