source: branches/Release-2-fixes/examples/test.py@ 1942

Last change on this file since 1942 was 656, checked in by mar637, 19 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1#test the $Date: 2005-06-22 06:18:17 +0000 (Wed, 22 Jun 2005) $ field
2#import genera operating system related functions
3import os
4#import asap module
5from asap import *
6# create a readersa and open an RPFITS file
7r = reader('/u/mmarquar/zorro/singledish/data/2001-09-01_0332_P363.rpf')
8# create a vector with numbers [0..109]
9integrations = range(110)
10# get the data out of the reader
11scans = r.read(integrations)
12# close the reader
13r = None
14print 'Begin export test...'
15# Write out the spectra in SDFITS format
16scans.save('/tmp/test_SDWriter.sdfits','SDFITS')
17# clean up
18print "removing test_SDWriter.sdfits ..."
19os.remove('/tmp/test_SDWriter.sdfits')
20# print a short summary of the data
21scans.summary()
22# get the scan with the number '0'
23scan = scans.get_scan(0)
24# get the scan with the name 'ref_R'
25ref = scans.get_scan('ref_R')
26# close the data table
27scans = None
28# open the math server
29# average the "on" scan
30scanav = average_time(scan)
31# get rid of the original scan
32scan = None
33# print a summary of the scan
34scanav.summary()
35# average the "off" scan
36refav = average_time(ref)
37# get rid of the original scan
38ref = None
39# print a summary of the scan
40refav.summary()
41# form the quotione spectrum
42quot = quotient(scanav,refav)
43# set the cursor to polarisation 0
44quot.set_cursor(pol=0)
45# get the spectrum for polarisation 0
46v0 = quot._getspectrum()
47#print the first ten channel
48print v0[0:10]
49# set the cursor to polarisation 1
50quot.set_cursor(pol=1)
51# get the spectrum for polarisation 1
52v1 = quot._getspectrum()
53#print the first ten channel
54print v1[0:10]
55# write it to disk for further use
56quot.save('/tmp/myfirstquotient.asap')
57# cleanup
58print "removing /tmp/myfirstquotient.asap ..."
59os.system('rm -rf /tmp/myfirstquotient.asap')
60print "Test successful."
Note: See TracBrowser for help on using the repository browser.