Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/sdtimeaverage.py: 100%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1##################### generated by xml-casa (v2) from sdtimeaverage.xml #############
2##################### ffe403c03a9e371c5ec04b5ebcd69334 ##############################
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_sdtimeaverage import sdtimeaverage as _sdtimeaverage_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 _sdtimeaverage:
15 """
16 sdtimeaverage ---- Average SD data, perform time averaging
20 The task sdtimeaverage is an SD task for averaging spectral data
21 over specified time range.
24 --------- parameter descriptions ---------------------------------------------
26 infile name of input SD dataset
27 datacolumn name of data column to be used ["data", "float_data", or "corrected_data"]
28 field select data by field IDs and names, e.g. "3C2*" (""=all)
29 spw select data by spectral windows and channels, e.g. "3,5,7" (""=all)
30 timerange select data by time range, e.g. "09:14:0~09:54:0" (""=all) (see examples in help)
31 scan select data by scan numbers, e.g. "21~23" (""=all)
32 antenna antenna IDs to be averaged over, e.g. "PM03" (""=all)
33 timebin bin width for time averaging.
34 timespan span across scan, state or both.
35 outfile name of output file
37 --------- examples -----------------------------------------------------------
40 -----------------
41 Keyword arguments
42 -----------------
43 infile -- name of input SD dataset
44 datacolumn -- name of data column to be used
45 options: 'data', 'float_data', or 'corrected_data'
46 default: 'float_data'
47 In case the column 'float_data' does not exists on the specified MS,
48 sdtimeaverage alternatively attempt to use 'data' column.
50 field -- select data by field IDs and names
51 default: '' (use all fields)
52 example: field='3C2*' (all names starting with 3C2)
53 field='0,4,5~7' (field IDs 0,4,5,6,7)
54 field='0,3C273' (field ID 0 or field named 3C273)
55 this selection is in addition to the other selections to data
56 spw -- select data by IF IDs (spectral windows)
57 default: '' (use all IFs)
58 example: spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
59 spw='<2'; spectral windows less than 2 (i.e. 0,1)
60 this selection is in addition to the other selections to data
61 timerange -- select data by time range
62 default: '' (use all)
63 example: timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
64 Note: YYYY/MM/DD can be dropped as needed:
65 timerange='09:14:00~09:54:00' # this time range
66 timerange='09:44:00' # data within one integration of time
67 timerange='>10:24:00' # data after this time
68 timerange='09:44:00+00:13:00' #data 13 minutes after time
69 this selection is in addition to the other selections to data
70 scan -- select data by scan numbers
71 default: '' (use all scans)
72 example: scan='21~23' (scan IDs 21,22,23)
73 this selection is in addition to the other selections to data
74 antenna -- select data by antenna name or ID
75 default: '' (use all antennas)
76 example: 'PM03'
77 timebin -- bin width for time averaging
78 default: 'all'
79 example: timebin='100s' (time averaging performed over 100 second bins)
80 timebin='' (use all)
81 timespan -- Let the timebin span across scan, state or both.
82 State is equivalent to sub-scans. One scan may have several
83 state ids. For ALMA MSs, the sub-scans are limited to about
84 30s duration each. In these cases, the task will automatically
85 add state to the timespan parameter. To see the number of states
86 in an MS, use the msmd tool. See help msmd.
88 default: 'scan' (separate time bins by both of the above)
89 options: 'scan', 'state', 'state,scan', ''
91 examples:
92 timespan = 'scan'; can be useful when the scan number
93 goes up with each integration as in many WSRT MSs.
94 timespan = ['scan', 'state']: disregard scan and state
95 numbers when time averaging.
96 timespan = 'state,scan'; same as above
97 timespan = '': averages for each combination of scan and state
98 outfile -- name of output file
101 """
103 _info_group_ = """single dish"""
104 _info_desc_ = """Average SD data, perform time averaging"""
106 def __call__( self, infile='', datacolumn='float_data', field='', spw='', timerange='', scan='', antenna='', timebin='all', timespan='scan', outfile='' ):
107 schema = {'infile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'data', 'float_data', 'corrected' ]}, '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}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timebin': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timespan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}}
108 doc = {'infile': infile, 'datacolumn': datacolumn, 'field': field, 'spw': spw, 'timerange': timerange, 'scan': scan, 'antenna': antenna, 'timebin': timebin, 'timespan': timespan, 'outfile': outfile}
109 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
110 _logging_state_ = _start_log( 'sdtimeaverage', [ 'infile=' + repr(_pc.document['infile']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'timerange=' + repr(_pc.document['timerange']), 'scan=' + repr(_pc.document['scan']), 'antenna=' + repr(_pc.document['antenna']), 'timebin=' + repr(_pc.document['timebin']), 'timespan=' + repr(_pc.document['timespan']), 'outfile=' + repr(_pc.document['outfile']) ] )
111 task_result = None
112 try:
113 task_result = _sdtimeaverage_t( _pc.document['infile'], _pc.document['datacolumn'], _pc.document['field'], _pc.document['spw'], _pc.document['timerange'], _pc.document['scan'], _pc.document['antenna'], _pc.document['timebin'], _pc.document['timespan'], _pc.document['outfile'] )
114 except Exception as exc:
115 _except_log('sdtimeaverage', exc)
116 raise
117 finally:
118 task_result = _end_log( _logging_state_, 'sdtimeaverage', task_result )
119 return task_result
121sdtimeaverage = _sdtimeaverage( )