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