Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/exportuvfits.py: 89%
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 exportuvfits.xml ##############
2##################### e9744e7d03285da3e979c183810b8077 ##############################
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_exportuvfits import exportuvfits as _exportuvfits_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 _exportuvfits:
15 """
16 exportuvfits ---- Convert a CASA visibility data set to a UVFITS file:
19 This task writes a UVFITS file, a general format data set used to
20 transfer data between different software systems. It is written in
21 floating point format. Different programs have different
22 restrictions on what forms of UVFITS files they will use, especially
23 whether they will accept multiple sources and/or spectral windows in
24 the same file. See the spw, multisource, and combinespw descriptions
25 below.
27 IMPORTANT NOTE: In general, some of the data averaging features of
28 this task have never worked properly. In general, users should run
29 mstransform to select and average data prior to running
30 exportuvfits. The associated input parameters are being slowly
31 deprecated and removed.
33 --------- parameter descriptions ---------------------------------------------
35 vis Name of input visibility file
36 Default: none
38 Example: vis='ngc5921.ms'
39 fitsfile Name of output UV FITS file
40 Default: none
42 Example: vis='ngc5921XC1.fits'
43 datacolumn Visibility file data column
44 Default: corrected
45 Options: 'data'(raw)|'corrected'|'model'|'weight'
47 Example: datacolumn='model'
48 field Select field using field id(s) or field name(s)
49 Default: '' --> all fields
51 Use 'go listobs' to obtain the list id's or
52 names. If field string is a non-negative integer,
53 it is assumed a field index, otherwise, it is
54 assumed a field name.
56 Examples:
57 field='0~2'; field ids 0,1,2
58 field='0,4,5~7'; field ids 0,4,5,6,7
59 field='3C286,3C295'; field named 3C286 and
60 3C295
61 field = '3,4C*'; field id 3, all names
62 starting with 4C
63 spw Select spectral window/channels
65 Examples:
66 spw='0~2,4'; spectral windows 0,1,2,4 (all
67 channels)
68 spw='<2'; spectral windows less than 2
69 (i.e. 0,1)
70 spw='0:5~61'; spw 0, channels 5 to 61,
71 INCLUSIVE
72 spw='\*:5~61'; all spw with channels 5 to 61
73 spw='0,10,3:3~45'; spw 0,10 all channels, spw
74 3, channels 3 to 45.
75 spw='0~2:2~6'; spw 0,1,2 with channels 2
76 through 6 in each.
77 spw='0:0~10;15~60'; spectral window 0 with
78 channels 0-10,15-60. (NOTE ';' to separate
79 channel selections)
80 spw='0:0~10^2,1:20~30^5'; spw 0, channels
81 0,2,4,6,8,10, spw 1, channels 20,25,30
82 type 'help par.selection' for more examples.
83 antenna Select data based on antenna/baseline
84 Subparameter of selectdata=True
85 Default: '' (all)
87 If antenna string is a non-negative integer, it
88 is assumed an antenna index, otherwise, it is
89 assumed as an antenna name
91 Examples:
92 antenna='5&6'; baseline between antenna
93 index 5 and index 6.
94 antenna='VA05&VA06'; baseline between VLA
95 antenna 5 and 6.
96 antenna='5&6;7&8'; baselines with
97 indices 5-6 and 7-8
98 antenna='5'; all baselines with antenna index
99 5
100 antenna='05'; all baselines with antenna
101 number 05 (VLA old name)
102 antenna='5,6,10'; all baselines with antennas
103 5,6,10 index numbers
104 timerange Select data based on time range
105 Subparameter of selectdata=True
106 Default = '' (all)
108 Examples:
109 timerange =
110 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
111 (Note: if YYYY/MM/DD is missing date defaults
112 to first day in data set.)
113 timerange='09:14:0~09:54:0' picks 40 min on
114 first day
115 timerange= '25:00:00~27:30:00' picks 1 hr to 3
116 hr 30min on NEXT day
117 timerange='09:44:00' pick data within one
118 integration of time
119 timerange='>10:24:00' data after this time
120 writesyscal Write GC and TY tables. Not yet available.
121 Default: False
122 multisource Write in multi-source format?
123 Default: True
125 Set to False if only one source is selected.
127 Note: diffmap does not work on multisource uvfits
128 files, so if planning on using diffmap on the
129 resulting uvfits file, select a single source and
130 set multisource = False. Otherwise use True. (If
131 multiple sources are selected, a multi-source
132 file will be written no matter what the setting
133 of this parameter).
134 combinespw Export the spectral windows as IFs?
135 Default: True
137 If True, export the spectral windows as
138 IFs. All spectral windows must have same
139 shape. Otherwise multiple windows will use
140 multiple FREQIDs.
141 writestation Write station name instead of antenna name
142 Default: True
143 padwithflags Fill in missing data with flags to fit IFs
144 Subparameter of combinespw=True
145 Default: True
147 If True, and combinespw is True, fill in missing
148 data as needed to fit the IF structure. This is
149 appropriate if the MS had a few
150 frequency-dependent flags applied, and was then
151 time-averaged by split, or when exporting for use
152 by difmap. If the spectral windows were observed
153 at different times, padwithflags=True will add a
154 large number of flags, making the output file
155 significantly longer. It does not yet support
156 spectral windows with different widths.
157 overwrite Overwrite output file if it exists?
158 Default: False
159 Options: False|True
161 --------- examples -----------------------------------------------------------
165 For more information, see the task pages of exportuvfits in CASA Docs:
167 https://casa.nrao.edu/casadocs/
170 """
172 _info_group_ = """import/export"""
173 _info_desc_ = """Convert a CASA visibility data set to a UVFITS file:"""
175 def __call__( self, vis='', fitsfile='', datacolumn='corrected', field='', spw='', antenna='', timerange='', writesyscal=False, multisource=True, combinespw=True, writestation=True, padwithflags=False, overwrite=False ):
176 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'fitsfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'data', 'corrected', 'model', 'weight' ]}, 'field': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, {'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}]}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'writesyscal': {'type': 'cBool'}, 'multisource': {'type': 'cBool'}, 'combinespw': {'type': 'cBool'}, 'writestation': {'type': 'cBool'}, 'padwithflags': {'type': 'cBool'}, 'overwrite': {'type': 'cBool'}}
177 doc = {'vis': vis, 'fitsfile': fitsfile, 'datacolumn': datacolumn, 'field': field, 'spw': spw, 'antenna': antenna, 'timerange': timerange, 'writesyscal': writesyscal, 'multisource': multisource, 'combinespw': combinespw, 'writestation': writestation, 'padwithflags': padwithflags, 'overwrite': overwrite}
178 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
179 _logging_state_ = _start_log( 'exportuvfits', [ 'vis=' + repr(_pc.document['vis']), 'fitsfile=' + repr(_pc.document['fitsfile']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'timerange=' + repr(_pc.document['timerange']), 'writesyscal=' + repr(_pc.document['writesyscal']), 'multisource=' + repr(_pc.document['multisource']), 'combinespw=' + repr(_pc.document['combinespw']), 'writestation=' + repr(_pc.document['writestation']), 'padwithflags=' + repr(_pc.document['padwithflags']), 'overwrite=' + repr(_pc.document['overwrite']) ] )
180 task_result = None
181 try:
182 task_result = _exportuvfits_t( _pc.document['vis'], _pc.document['fitsfile'], _pc.document['datacolumn'], _pc.document['field'], _pc.document['spw'], _pc.document['antenna'], _pc.document['timerange'], _pc.document['writesyscal'], _pc.document['multisource'], _pc.document['combinespw'], _pc.document['writestation'], _pc.document['padwithflags'], _pc.document['overwrite'] )
183 except Exception as exc:
184 _except_log('exportuvfits', exc)
185 raise
186 finally:
187 task_result = _end_log( _logging_state_, 'exportuvfits', task_result )
188 return task_result
190exportuvfits = _exportuvfits( )