from casatools import msmetadata
from casatools import table
from casatools import measures
from casatools import quanta
from casatools import ms as mstool
from casatools import image
from casatasks import casalog
from __casac__.msmetadata import msmetadata
from __casac__.table import table
from __casac__.measures import measures
from __casac__.quanta import quanta
from __casac__.ms import ms as mstool
from __casac__.image import image
from taskinit import casalog
MetaDataSet = collections.namedtuple(
MsMeta = collections.namedtuple(
['positions', 'times', 'freqmin', 'freqmax']
EphemMeta = collections.namedtuple(
['table', 'times', 'unit_time', 'velocities', 'unit_vel', 'frame_vel']
FrequencyRange = collections.namedtuple(
COMMON_VELOCITY_UNIT = 'km/s'
for m in msg.split('\n'):
casalog.post('DEBUG: {}'.format(m))
def inspect_ms(vis, fieldid, spwid, chanstart=0, nchan=-1):
fieldid {int} -- FIELD_ID for target
spwid {int} -- SPW_ID for target spw
chanstart {int} -- start channel (default: 0)
nchan {int} -- number of channels
(default: -1 => from chanstart to end channel of spw)
MsMeta -- namedtuple containing metadata
positions: list of antenna positions
times: list of timestamps for target field
freqmin: minimum frequency of given spw as measure
freqmax: maximum frequency of given spw as measure
positions = list(map(msmd.antennaposition, msmd.antennaids()))
chanfreqs = msmd.chanfreqs(spwid)
chanwidths = msmd.chanwidths(spwid)
end = min(chanstart + nchan, len(chanfreqs)) if nchan >= 0 else len(chanfreqs)
debug_print('start {}, end {}'.format(start, end))
freqmin = chanfreqs[start:end].min() - cw / 2
freqmax = chanfreqs[start:end].max() + cw / 2
debug_print('freqmin {}, freqmax {}'.format(freqmin, freqmax))