Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/sdsmooth.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
1##################### generated by xml-casa (v2) from sdsmooth.xml ##################
2##################### 1faefec8c7f2376940dc98c5d1f95d26 ##############################
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_sdsmooth import sdsmooth as _sdsmooth_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 _sdsmooth:
15 """
16 sdsmooth ---- Smooth spectral data
19 Task sdsmooth performs smoothing along spectral axis using user-specified
20 smoothing kernel. Currently gaussian and boxcar kernels are supported.
23 --------- parameter descriptions ---------------------------------------------
25 infile name of input SD dataset
26 datacolumn name of data column to be used ["data", "float_data", or "corrected"]
27 antenna select data by antenna name or ID, e.g. "PM03"
28 field select data by field IDs and names, e.g. "3C2*" (""=all)
29 spw select data by spectral window IDs, 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 pol select data by polarization IDs, e.g. "0,1" (""=all)
33 intent select data by observational intent, e.g. "*ON_SOURCE*" (""=all)
34 reindex Re-index indices in subtables based on data selection
35 kernel spectral smoothing kernel type
36 kwidth smoothing kernel width in channel
37 outfile name of output file
38 overwrite overwrite the output file if already exists
39 [1;42mRETURNS[1;m void
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'
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 spectral window IDs/channels
61 default: '' (use all spws and channels)
62 example: spw='3,5,7' (spw IDs 3,5,7; all channels)
63 spw='<2' (spw IDs less than 2, i.e., 0,1; all channels)
64 spw='30~45GHz' (spw IDs with the center frequencies in range 30-45GHz; all channels)
65 spw='0:5~61' (spw ID 0; channels 5 to 61; all channels)
66 spw='3:10~20;50~60' (select multiple channel ranges within spw ID 3)
67 spw='3:10~20,4:0~30' (select different channel ranges for spw IDs 3 and 4)
68 spw='1~4;6:15~48' (for channels 15 through 48 for spw IDs 1,2,3,4 and 6)
69 this selection is in addition to the other selections to data
70 timerange -- select data by time range
71 default: '' (use all)
72 example: timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
73 Note: YYYY/MM/DD can be dropped as needed:
74 timerange='09:14:00~09:54:00' # this time range
75 timerange='09:44:00' # data within one integration of time
76 timerange='>10:24:00' # data after this time
77 timerange='09:44:00+00:13:00' #data 13 minutes after time
78 this selection is in addition to the other selections to data
79 scan -- select data by scan numbers
80 default: '' (use all scans)
81 example: scan='21~23' (scan IDs 21,22,23)
82 this selection is in addition to the other selections to data
83 pol -- select data by polarization IDs
84 default: '' (use all polarizations)
85 example: pol='0,1' (polarization IDs 0,1)
86 this selection is in addition to the other selections to data
87 intent -- select data by observational intent, also referred to as 'scan intent'
88 default: '' (use all scan intents)
89 example: intent='*ON_SOURCE*' (any valid scan-intent expression accepted by the MSSelection module can be specified)
90 this selection is in addition to the other selections to data
91 reindex -- Re-index indices in subtables based on data selection.
92 If True, DATA_DESCRIPTION, FEED, SPECTRAL_WINDOW, STATE, and SOURCE
93 subtables are filtered based on data selection and re-indexed in output MS.
94 default: True
95 kernel -- type of spectral smoothing kernel
96 options: 'gaussian', 'boxcar'
97 default: 'gaussian' (no smoothing)
99 >>>kernel expandable parameter
100 kwidth -- width of spectral smoothing kernel
101 options: (int) in channels
102 default: 5
103 outfile -- name of output file
104 default: '' (<infile>_bs)
105 overwrite -- overwrite the output file if already exists
106 options: (bool) True, False
107 default: False
108 NOTE this parameter is ignored when outform='ASCII'
111 -----------
112 DESCRIPTION
113 -----------
114 Task sdsmooth performs smoothing along spectral axis using user-specified
115 smoothing kernel. Currently gaussian and boxcar kernels are supported.
121 """
123 _info_group_ = """single dish"""
124 _info_desc_ = """Smooth spectral data """
126 def __call__( self, infile='', datacolumn='data', antenna='', field='', spw='', timerange='', scan='', pol='', intent='', reindex=True, kernel='gaussian', kwidth=int(5), outfile='', overwrite=False ):
127 schema = {'infile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'DATA', 'corrected', 'FLOAT_DATA', 'CORRECTED', 'float_data', 'data' ]}, '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}, 'pol': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'reindex': {'type': 'cBool'}, 'kernel': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'gaussian', 'boxcar' ]}, 'kwidth': {'type': 'cInt'}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}}
128 doc = {'infile': infile, 'datacolumn': datacolumn, 'antenna': antenna, 'field': field, 'spw': spw, 'timerange': timerange, 'scan': scan, 'pol': pol, 'intent': intent, 'reindex': reindex, 'kernel': kernel, 'kwidth': kwidth, 'outfile': outfile, 'overwrite': overwrite}
129 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
130 _logging_state_ = _start_log( 'sdsmooth', [ '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']), 'pol=' + repr(_pc.document['pol']), 'intent=' + repr(_pc.document['intent']), 'reindex=' + repr(_pc.document['reindex']), 'kernel=' + repr(_pc.document['kernel']), 'kwidth=' + repr(_pc.document['kwidth']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']) ] )
131 task_result = None
132 try:
133 task_result = _sdsmooth_t( _pc.document['infile'], _pc.document['datacolumn'], _pc.document['antenna'], _pc.document['field'], _pc.document['spw'], _pc.document['timerange'], _pc.document['scan'], _pc.document['pol'], _pc.document['intent'], _pc.document['reindex'], _pc.document['kernel'], _pc.document['kwidth'], _pc.document['outfile'], _pc.document['overwrite'] )
134 except Exception as exc:
135 _except_log('sdsmooth', exc)
136 raise
137 finally:
138 task_result = _end_log( _logging_state_, 'sdsmooth', task_result )
139 return task_result
141sdsmooth = _sdsmooth( )