" antenna='ea17' spw='0:1~2;4~11' timerange='2010/04/08/20:04:50.614~2010/04/08/20:05:07.259,2010/04/08/20:04:50.917~2010/04/08/20:04:58.403,2010/04/08/20:06:01.627~2010/04/08/20:06:05.527,2010/04/08/20:06:16.444~2010/04/08/20:06:20.656,2010/04/08/20:06:36.308~2010/04/08/20:06:40.113,2010/04/08/20:06:56.059~2010/04/08/20:06:59.095,2010/04/08/20:07:16.302~2010/04/08/20:07:19.909,2010/04/08/20:07:36.027~2010/04/08/20:07:40.325,2010/04/08/20:07:56.374~2010/04/08/20:08:00.534,2010/04/08/20:08:16.436~2010/04/08/20:08:20.406,2010/04/08/20:08:35.928~2010/04/08/20:08:39.026,2010/04/08/20:08:56.301~2010/04/08/20:08:59.788,2010/04/08/20:09:16.035~2010/04/08/20:09:20.368,2010/04/08/20:09:36.382~2010/04/08/20:09:40.741,2010/04/08/20:09:56.591~2010/04/08/20:10:00.388,2010/04/08/20:10:16.083~2010/04/08/20:10:19.120,2010/04/08/20:10:36.085~2010/04/08/20:10:39.700,2010/04/08/20:10:49.701~2010/04/08/20:11:07.582,2010/04/08/20:10:49.900~2010/04/08/20:10:57.482,2010/04/08/20:10:50.401~2010/04/08/20:10:54.665'",
Unit tests for task split.
1. Are the POLARIZATION, DATA_DESCRIPTION, and (to some extent) the
SPECTRAL_WINDOW tables correct with and without correlation selection?
2. Are the data shapes and values correct with and without correlation
3. Are the WEIGHT and SIGMA shapes and values correct with and without
4. Is a SOURCE table with bogus entries properly handled?
5. Is the STATE table properly handled?
6. Are generic subtables copied over?
7. Are CHAN_WIDTH and RESOLUTION properly handled in SPECTRAL_WINDOW when
channels are being selected and/or averaged?
8. The finer points of spw:chan selection.
Note: The time_then_chan_avg regression is a more "end-to-end" test of split.
from __main__ import default
from recipes.listshapes import listshapes
from tasks import split, partition, split, listobs, flagdata, importasdm, flagcmd
from taskinit import mstool, msmdtool, tbtool
from parallel.parallel_task_helper import ParallelTaskHelper
from casa_stack_manip import stack_frame_find
datapath = os.environ.get('CASAPATH').split()[0] + '/data/regression/unittest/split/'
if os.environ.has_key('TEST_DATADIR'):
DATADIR = str(os.environ.get('TEST_DATADIR'))
if os.path.isdir(DATADIR):
datapath = DATADIR+'/split/'
print 'split tests will use data from '+datapath
if os.environ.has_key('BYPASS_PARALLEL_PROCESSING'):
ParallelTaskHelper.bypassParallelProcessing(1)
Start of old tests, which are the same as test_split.
class SplitFlags on are new tests.
def check_eq(val, expval, tol=None):
"""Checks that val matches expval within tol."""
check_eq(val[k], expval[k], tol)
if tol and hasattr(val, '__rsub__'):
are_eq = abs(val - expval) < tol
if hasattr(are_eq, 'all'):
errmsg = "%r != %r" % (val, expval)
errmsg = "\n%r\n!=\n%r" % (val, expval)
print "Error comparing", val, "to", expval
def slurp_table(tabname):
Returns a dictionary containing the CASA table tabname. The dictionary
{'keywords': tblocal.getkeywords(),
'cols': {colname0, {'desc': tblocal.getcoldesc(colname0),
'keywords': tblocal.getcolkeywords(colname0),