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