Source
xxxxxxxxxx
refwtsp = self._get_interpolated_wtsp(mode, spw, nchan, interplist, irow, has_wtsp)
##########################################################################
# test_task_initweights.py
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA.
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
#
# Based on the requirements listed in casadocs found here:
# https://casadocs.readthedocs.io/en/stable/api/tt/casatasks.calibration.initweights.html
#
##########################################################################
import os
import shutil
import numpy
import unittest
from casatools import ctsys, table
from casatasks import initweights
class initweights_common(unittest.TestCase):
"""
A base test class for initweights task
"""
datapath = ctsys.resolve('unittest/initweights/')
# Pick up alternative data directory to run tests on MMSs
testmms = False
if 'TEST_DATADIR' in os.environ:
DATADIR = str(os.environ.get('TEST_DATADIR'))+'/initweights/'
if os.path.isdir(DATADIR):
testmms = True
datapath = DATADIR
else:
raise ValueError('Could not find input data in datapath=%s' % DATADIR)
print('initweights tests will use data from %s' % datapath)
inputms = "tsysweight_ave.ms"
tsystable = "tsysweight_ave.tsys.cal"
"""
Note:
tsys spws in 'tsysweight_ave.tsys.cal' are 1,3,5,7
spw maps in tsysweight_ave.ms are 1->1,9, 3->3,11, 5->5,13, 7->7,15
All data and weight/sigma columns are intialized to 1.0
It does NOT have WEIGHT_SPECTRUM and SIGMA_SPECTRUM columns at first.
# Tsys spectra in the first Tsys measurements (the second one has +10 offset)
# spw 1: Tsys[ichan] = 50.
# spw 3: Tsys[ichan] = 45. + 10*ichan/nchan
# spw 5: Tsys[ichan] = 50. + 10*(ichan/nchan)^2
# spw 7: Tsys[ichan] = 60.
"""
# the list of tables to copy and clear up in each test.
templist = [inputms, tsystable]
spwmap = [0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 10, 3, 12, 5, 14, 7]