source: branches/casa-release-4_3-test/test/test_observatories/test_mopra.py@ 3023

Last change on this file since 3023 was 2787, checked in by WataruKawasaki, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description: asap unit test fix


File size: 1.5 KB
Line 
1#!/usr/bin/env python
2import os
3from asap import *
4from nose.tools import assert_almost_equals
5rcParams['verbose'] = 0
6rcParams['plotter.gui'] = 0
7
8
9DATA=os.path.join(os.path.split(__file__)[0], "..", "data",
10 "mopra_dualif.rpf")
11
12
13class TestMopra(object):
14 def setup(self):
15 self.st = scantable(DATA)
16
17 def _plotfit(self, scan, ifno):
18 scan.set_selection(ifs=ifno)
19 f = fitter()
20 f.set_scan(scan)
21 f.set_function(gauss=ifno+1) # fit gaussian(s)
22 f.fit()
23 f.plot(filename='output/moprafit_if%d.png' % ifno)
24 fp = f.get_parameters()
25 assert True
26
27 def test_reduction(self):
28 restfreqs = [110.201, 86.243] # 13CO-1/0, SiO the two IF
29 self.st.set_restfreqs(restfreqs,"GHz")
30 q = self.st.auto_quotient()
31 q.set_unit("km/s") # set the unit to be used from now on
32 q.set_freqframe("LSRK") # set frequency frame
33 q.auto_poly_baseline(insitu=True) # determine and subtract a poly
34 # baseline automatically
35 q.convert_flux() # K -> Jy
36 msk = q.create_mask([-70,20], [20,70]) # line free region - two windows
37 rms = q.stats("rms", msk)
38 med = q.stats("median", msk)
39 regrms = [35.801266, 38.808666]
40 regmed = [1.197934, 2.593804]
41 for i in range(len(rms)):
42 assert_almost_equals(rms[i], regrms[i], 6)
43 assert_almost_equals(med[i], regmed[i], 6)
44
45 for ifno in q.getifnos():
46 self._plotfit(q, ifno)
Note: See TracBrowser for help on using the repository browser.