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