Source
xxxxxxxxxx
'''cvel2 15: I/O vis set, input vis with two spws, one field selected, 2 spws selected, passall = False, regridding 8...'''
#########################################################################
# test_task_cvel2.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.manipulation.cvel2.html
#
##########################################################################
import os
import numpy
import shutil
import unittest
from casatasks import cvel2, cvel, split, importuvfits, partition
from casatools import ms as mstool
from casatools import ctsys, table, quanta
from casatasks.private.parallel.parallel_task_helper import ParallelTaskHelper
from casatasks.private.parallel.parallel_data_helper import ParallelDataHelper
from casatestutils import testhelper as th
mytb = table()
myqa = quanta()
datapath = ctsys.resolve('unittest/cvel/')
ephedata = ctsys.resolve('ephemerides/JPL-Horizons/Jupiter_54708-55437dUTC.tab')
# 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'))+'/cvel/'
if os.path.isdir(DATADIR):
testmms = True
datapath = DATADIR
print('cvel2 tests will use data from '+datapath)
if 'BYPASS_PARALLEL_PROCESSING' in os.environ:
ParallelTaskHelper.bypassParallelProcessing(1)
myname = 'test_cvel'
vis_a = 'ngc4826.ms'
vis_b = 'ARP299F_sma_2scans_24spws_negative_chanwidth.ms'
vis_c = 'jupiter6cm.demo-thinned.ms'
vis_d = 'g19_d2usb_targets_line-shortened-thinned.ms'
vis_e = 'evla-highres-sample-thinned.ms'
vis_f = 'test_cvel1.ms'
vis_g = 'jup.ms'
outfile = 'cvel-output.ms'
myms = mstool()
class test_base(unittest.TestCase):
# forcereload=False
def setUp_vis_a(self):
# 308 scans, spw=0, data
if testmms:
os.system('cp -RL ' + datapath + vis_a + ' .')
elif (not os.path.exists(vis_a)):
importuvfits(fitsfile=os.path.join(datapath,'ngc4826.ll.fits5'), # 10 MB
vis=vis_a)
def setUp_vis_b(self):
# 308 scans, spw=0, data
if testmms:
os.system('cp -RL ' + datapath + vis_b + ' .')
elif(not os.path.exists(vis_b)):
os.system('cp -RL '+os.path.join(datapath,'ARP299F_sma_2scans_24spws_negative_chanwidth.ms')+' .') # 27 MB
def setUp_vis_c(self):
# 93 scans, spw=0,1, data
if testmms:
os.system('cp -RL ' + datapath + vis_c + ' .')
elif(not os.path.exists(vis_c)):
os.system('cp -RL '+os.path.join(datapath,'jupiter6cm.demo-thinned.ms')+' .') # 124 MB
def setUp_vis_d(self):
# scan=3,4 spw=0~23, data
if testmms:
os.system('cp -RL ' + datapath + vis_d + ' .')