source: trunk/test/test_nrofiller.py@ 2735

Last change on this file since 2735 was 2677, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Skip frequency test for nro filler.


File size: 1.8 KB
RevLine 
[1853]1import sys
2import os
3import shutil
4import datetime
5from asap import scantable, selector, mask_not
6from asap.logging import asaplog
7asaplog.disable()
8
9from nose.tools import *
[2659]10from nose.plugins.skip import SkipTest
[1853]11
12def tempdir_setup():
13 os.makedirs("test_temp")
14
15def tempdir_teardown():
16 shutil.rmtree("test_temp", True)
17
18class TestNRO(object):
19 def setup(self):
20 s = scantable('data/B68test.nro', average=False)
21 sel = selector()
22 # make sure this order is always correct - it can be random
23 sel.set_order(["SCANNO", "POLNO"])
24 s.set_selection(sel)
25 self.st = s.copy()
[2668]26 del s
[1853]27
[2668]28 def tearDown(self):
29 del self.st
30
[1853]31 def test_init(self):
32 assert_equal(self.st.nrow(), 36)
33 assert_equal(self.st.get_fluxunit(), 'K')
34 assert_equal(self.st.nchan(), 2048)
35 assert_equal(self.st.nif(), 4)
36
37 def test_spectrum(self):
38 import numpy
39 sp=numpy.array(self.st._getspectrum(0))
40 assert_equal(sp.max(),1.9524071216583252)
41 assert_equal(sp.min(),-0.0071961274370551109)
42 assert_equal(sp.argmax(),1648)
43 assert_equal(sp.argmin(),1614)
44
45 def test_stats(self):
46 assert_equal(self.st.stats('rms')[0],1.1064267158508301)
47 assert_equal(self.st.stats('stddev')[0],0.29552212357521057)
48 assert_equal(self.st.stats('median')[0],1.0714811086654663)
49 assert_equal(self.st.stats('mean')[0],1.0662506818771362)
50 assert_equal(self.st.stats('sum')[0],2183.681396484375)
51
[2659]52
[1853]53 def test_frequency(self):
[2677]54 raise SkipTest("Currently disabled")
[1853]55 rf=self.st.get_restfreqs()
56 assert_equal(len(rf),2)
57 assert_equal(rf[0][0],85162157000.0)
58 assert_equal(rf[1][0],86754330000.0)
59 self.st.set_unit('GHz')
60 abc=self.st._getabcissa(0)
[2668]61 assert_equal(abc[0],85.183349020848283)
Note: See TracBrowser for help on using the repository browser.