Changeset 1600 for trunk/test


Ignore:
Timestamp:
07/08/09 16:30:04 (15 years ago)
Author:
Malte Marquarding
Message:

Ticket #170: python derived class for nice access e.g. units and doc strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_scantable.py

    r1592 r1600  
    11import unittest
     2import datetime
    23from asap import scantable, selector, rcParams
    34rcParams["verbose"] = False
     
    5758        sel1 = self.st.get_selection()
    5859        self.assertEqual(sel1.get_pols(), [1])
     60        self.st.set_selection(pols="XX")
     61        self.assertEqual(self.st.getpolnos(), (0,))
    5962
    6063    def test_stats(self):
     
    8386        self.assertEqual(self.st.get_column_names(), cnames)
    8487
     88    def test_get_tsys(self):
     89        self.assertAlmostEqual(self.st.get_tsys()[0], 175.830429077)
     90
     91    def test_get_time(self):
     92        self.assertEqual(self.st.get_time(0), '2008/03/12/09:32:50')
     93        dt = datetime.datetime(2008,3,12,9,32,50)
     94        self.assertEqual(self.st.get_time(0, True), dt)
     95
     96    def test_get_inttime(self):
     97        self.assertAlmostEqual(self.st.get_inttime()[0], 30.720016479)
     98
     99    def test_get_sourcename(self):
     100        self.assertEqual(self.st.get_sourcename(0), 'Orion_SiO_R')
     101        self.assertEqual(self.st.get_sourcename()[:2], ['Orion_SiO_R', 'Orion_SiO'])
     102
     103    def test_get_azimuth(self):
     104        self.assertAlmostEqual(self.st.get_azimuth()[0], 5.628767013)
     105
     106    def test_get_elevation(self):
     107        self.assertAlmostEqual(self.st.get_elevation()[0], 1.01711678504)
     108
     109    def test_get_parangle(self):
     110        self.assertAlmostEqual(self.st.get_parangle()[0], 2.5921990871)
     111
     112    def test_get_direction(self):
     113        self.assertEqual(self.st.get_direction()[0], '05:35:14.5 -04.52.29.5')
     114
     115    def test_get_directionval(self):
     116        dv = self.st.get_directionval()[0]
     117        self.assertAlmostEqual(dv[0], 1.4627692699)
     118        self.assertAlmostEqual(dv[1], -0.0850824415)
     119
     120    def test_unit(self):
     121        self.st.set_unit('')
     122        self.st.set_unit('GHz')
     123        self.st.set_unit('km/s')
     124        self.assertRaises(RuntimeError, self.st.set_unit, 'junk')
     125        self.assertEquals(self.st.get_unit(), 'km/s')
     126
    85127    def test_average_pol(self):
    86128        ap = self.st.average_pol()
    87129        self.assertEqual(ap.npol(), 1)
    88130
     131    def test_drop_scan(self):
     132        s0 = self.st.drop_scan(1)
     133        self.assertEqual(s0.getscannos(), (0,))
     134        s1 = self.st.drop_scan([0])
     135        self.assertEqual(s1.getscannos(), (1,))
     136
    89137
    90138if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.