Changeset 1824 for trunk/test


Ignore:
Timestamp:
08/02/10 19:40:09 (14 years ago)
Author:
Malte Marquarding
Message:

Refactoring of init.py. Moved functionality into separate modules. Some minor fixes to make unit test work under 'standard asap'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_scantable.py

    r1725 r1824  
    11import unittest
    22import datetime
    3 from asap import scantable, selector, rcParams, mask_not
    4 rcParams["verbose"] = False
     3from asap import scantable, selector, rcParams, mask_not, asaplog
     4asaplog.disable()
    55
    66class ScantableTest(unittest.TestCase):
    77    def setUp(self):
    8 
    9         self.st = scantable("data/MOPS.rpf", average=True)
     8        s = scantable("data/MOPS.rpf", average=True)
     9        sel = selector()
     10        # make sure this order is always correct - in can be random
     11        sel.set_order(["SCANNO", "POLNO"])
     12        s.set_selection(sel)
     13        self.st = s.copy()
    1014        restfreqs = [86.243]     # 13CO-1/0, SiO the two IF
    1115        self.st.set_restfreqs(restfreqs,"GHz")
     
    7882    def test_get_column_names(self):
    7983        cnames = ['SCANNO', 'CYCLENO', 'BEAMNO', 'IFNO',
    80                   'POLNO', 'FREQ_ID', 'MOLECULE_ID', 'REFBEAMNO',
     84                  'POLNO', 'FREQ_ID', 'MOLECULE_ID', 'REFBEAMNO', 'FLAGROW',
    8185                  'TIME', 'INTERVAL', 'SRCNAME', 'SRCTYPE',
    8286                  'FIELDNAME', 'SPECTRA', 'FLAGTRA', 'TSYS',
     
    101105    def test_get_sourcename(self):
    102106        self.assertEqual(self.st.get_sourcename(0), 'Orion_SiO_R')
    103         self.assertEqual(self.st.get_sourcename()[:2], ['Orion_SiO_R', 'Orion_SiO'])
     107        self.assertEqual(self.st.get_sourcename(),
     108                         ['Orion_SiO_R', 'Orion_SiO_R',
     109                          'Orion_SiO', 'Orion_SiO'])
    104110
    105111    def test_get_azimuth(self):
     
    144150        msk = q0.create_mask([-10,20])
    145151        q0.flag(mask=mask_not(msk))
     152        q1.flag(mask=msk)
    146153        self.assertAlmostEqual(q0.stats(stat='max')[0], 95.62171936)
    147         q1.flag(mask=msk)
    148154        self.assertAlmostEqual(q1.stats(stat='max')[0], 2.66563416)
    149155
Note: See TracChangeset for help on using the changeset viewer.