from __future__ import absolute_import
from casatasks.private.casa_transition import *
from casatools import table, quanta
from casatools import ms as mstool
from casatasks import casalog
from .mstools import write_history
from mstools import write_history
passall, field, spw, selectdata, antenna, timerange, scan, array,
mode, nchan, start, width, interpolation,
phasecenter, restfreq, outframe, veltype, hanning):
""" regrid an MS to a new spectral window / channel structure or frame
vis -- Name of input visibility file
default: none; example: vis='ngc5921.ms'
outputvis -- Name of output measurement set (required)
default: none; example: vis='ngc5921-regridded.ms'
passall -- if False, data not meeting the selection on field or spw
is omitted; if True, data not meeting the selection
is passed through without modification
passall=False : only data from NGC5921 is included in output MS,
no data from other fields (e.g. 1331+305) is included
passall=True : data from NGC5921 is transformed by cvel, all other
fields are passed through unchanged
field -- Select fields in MS. Use field id(s) or field name(s).
['go listobs' to obtain the list id's or names]
If field string is a non-negative integer, it is assumed to
be a field index otherwise, it is assumed to be a
field='0~2'; field ids 0,1,2
field='0,4,5~7'; field ids 0,4,5,6,7
field='3C286,3C295'; field named 3C286 and 3C295
field = '3,4C*'; field id 3, all names starting with 4C
spw --Select spectral window/channels
NOTE: This selects the data passed as the INPUT to mode
default: ''=all spectral windows and channels
spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
spw='0:5~61'; spw 0, channels 5 to 61
spw='<2'; spectral windows less than 2 (i.e. 0,1)
spw='0,10,3:3~45'; spw 0,10 all channels, spw 3,
spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
spw='0:0~10;15~60'; spectral window 0 with channels
spw='0:0~10,1:20~30,2:1;2;3'; spw 0, channels 0-10,
spw 1, channels 20-30, and spw 2, channels, 1,2 and 3
selectdata -- Other data selection parameters
selectdata=True expandable parameters
antenna -- Select data based on antenna/baseline
If antenna string is a non-negative integer, it is
assumed to be an antenna index, otherwise, it is
considered an antenna name.
antenna='5&6'; baseline between antenna index 5 and
antenna='VA05&VA06'; baseline between VLA antenna 5
antenna='5&6;7&8'; baselines 5-6 and 7-8
antenna='5'; all baselines with antenna index 5
antenna='05'; all baselines with antenna number 05
antenna='5,6,9'; all baselines with antennas 5,6,9
timerange -- Select data based on time range:
default = '' (all); examples,