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