Changeset 1600


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

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/CHANGELOG

    r1580 r1600  
    22=========
    33
    4 Release 2.4.0 []
     4Release 3.0.0 []
    55
    66* Ticket #155 Better output filenames. Ignore non-existsing beams/pols/ifs/scans
     
    1111* Ticket #163 fixed for scantable.set_sourcetype
    1212* Ticket #164 Upgrade note in wiki FAQ
     13* Ticket #165 Handle non-parallactified polarimtery data (if supported in rpfits)
    1314* Ticket #167 Added running polynomial filter to scantable.smooth
    14 * Ticket #168 Data exported vi scnatable.save now contains correct frequency
    15   or velocity information
     15* Ticket #168 Data exported via scantable.save now contains correct frequency
     16              or velocity information
    1617* Ticket #169 Simplified selection of data
    17 * Ticket #46  Interactive lag flagging
    18 
     18* Ticket #46  Interactive lag flagging
     19* Ticket #170 Provided access to frequency coordinate information via
     20              scantable.get_coordinate
    1921* Added OS X 10.5 Disk image installer
    2022* Interactive plotting annotations via optional argument interactive=True
     
    3537* Ticket #149 Fixed the bug causing spectral line search to go into an infinite loop
    3638   in some rare circumstances
    37 * Ticket #110 Added export to CLASS readable FITS files 
     39* Ticket #110 Added export to CLASS readable FITS files
    3840   scantable.save("myfile.fits", "CLASS")
    3941* Ticket #142 Fix of the frequency alignment for long observations
    4042* Ticket #133 allow supression of history in the scantable via rc parameters
    41 * Ticket #109 source direction for Hobart data 
    42 * Ticket #115 added running median to scantable.(smooth(kernel='rmedian') 
     43* Ticket #109 source direction for Hobart data
     44* Ticket #115 added running median to scantable.(smooth(kernel='rmedian')
    4345* Ticket #148 opacity correction wasn't applied to TSYS
    4446* Ticket #135 quotient detection failure for specific source names
     
    7678* fix for Ticket #88 - numpy masks
    7779* better TAB completion for ipython (handles quotes, don't list private members)
    78 * Fix for Ticket #81 = scanatble.stats output as list 
     80* Fix for Ticket #81 = scanatble.stats output as list
    7981* ticket #64 - speed up of auto_poly_baseline
    8082* fix for ticket #89 - export of IF sub-selections
  • trunk/python/scantable.py

    r1594 r1600  
    55from asap import selector
    66from asap import linecatalog
     7from asap.coordinate import coordinate
    78from asap import _n_bools, mask_not, mask_and, mask_or
    89
     
    293294        assert(len(spec) == self.nchan())
    294295        return self._setspectrum(spec, rowno)
     296
     297    def get_coordinate(self, rowno):
     298        """Return the (spectral) coordinate for a a given 'rowno'.
     299        NOTE:
     300            * This coordinate is only valid until a scantable method modifies
     301              the frequency axis.
     302            * This coordinate does contain the original frequency set-up
     303              NOT the new frame. The conversions however are done using the user
     304              specified frame (e.g. LSRK/TOPO). To get the 'real' coordinate,
     305              use scantable.freq_align first. Without it there is no closure,
     306              i.e.
     307              c = myscan.get_coordinate(0)
     308              c.to_frequency(c.get_reference_pixel()) != c.get_reference_value()
     309
     310        Parameters:
     311             rowno:    the row number for the spectral coordinate
     312
     313        """
     314        return coordinate(Scantable.get_coordinate(self, rowno))
    295315
    296316    def get_selection(self):
  • trunk/src/STCoordinate.h

    r1599 r1600  
    2525  public:
    2626    STCoordinate() {};
     27
     28    STCoordinate(const STCoordinate& other) : spec_(other.spec_) {};
     29
    2730    STCoordinate(const casa::SpectralCoordinate& spec) :
    2831      spec_(spec) {};
  • 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.