Source
"""CAS-5818: Verify bogus dish diameters in AN table are not used but normal algorithm is used instead"""
import os
import numpy
import sys
import shutil
from __main__ import default
from tasks import *
from taskinit import *
import unittest
import numpy as np
'''
Unit tests for UVFITS I/O tasks.
Features tested:
0. Can multiple spws with the same # of channels be exported to UVFITS
using padwithflags?
1. When that UVFITS file is read back in, is its data still correct?
'''
datapath = os.environ.get('CASAPATH').split()[0] + '/data/regression/unittest/uvfits/'
datapath2 = os.environ.get('CASAPATH').split()[0] + '/data/regression/'
def check_eq(val, expval, tol=None):
"""Checks that val matches expval within tol."""
try:
if tol:
are_eq = abs(val - expval) < tol
else:
are_eq = val == expval
if hasattr(are_eq, 'all'):
are_eq = are_eq.all()
if not are_eq:
raise ValueError, '!='
except ValueError:
raise ValueError, "%r != %r" % (val, expval)
class uvfits_test(unittest.TestCase):
# 06/13/2010: This seemed to be the only MS in the regression repo
# that is a good test of padwithflag.
inpms = 'cvel/input/ANTEN_sort_hann_for_cvel_reg.ms'
origms = 'start.ms' # Just a copy of inpms
fitsfile = 'hanningsmoothed.UVF'
msfromfits = 'end.ms'
records = {}
need_to_initialize = True # Do once, at start.
do_teardown = False # Do once, after initializing and filling records.
# Its value here should not really matter.
def setUp(self):
pass
#if self.need_to_initialize:
# self.initialize()
#def initialize(self):
# The realization that need_to_initialize needs to be
# a class variable more or less came from
# http://www.gossamer-threads.com/lists/python/dev/776699
# self.__class__.need_to_initialize = False