source: trunk/test/test_nrofiller.py@ 2844

Last change on this file since 2844 was 2788, 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: nosetest test_nrofiller.py

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Enabled nrofiller test with fix that is disabled before.


File size: 1.9 KB
Line 
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 *
10from nose.plugins.skip import SkipTest
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, freqref='VREF')
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()
26 del s
27
28 def tearDown(self):
29 del self.st
30
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
52
53 def test_frequency(self):
54 #raise SkipTest("Currently disabled")
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)
61 assert_almost_equal(abc[0],85.182400000256166,places=14)
Note: See TracBrowser for help on using the repository browser.