Last change
on this file since 24 was
20,
checked in by mmarquar, 20 years ago
|
A small test program for the asap package.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.3 KB
|
Rev | Line | |
---|
[20] | 1 | #import atnf_sd module |
---|
| 2 | from atnf_sd import * |
---|
| 3 | # create a reader |
---|
| 4 | r = sdreader() |
---|
| 5 | # open an RPFITS file |
---|
| 6 | r.open('/u/mmarquar/zorro/singledish/data/2001-09-01_0332_P363.rpf') |
---|
| 7 | # create a vector with numbers [0..109] |
---|
| 8 | integrations = range(110) |
---|
| 9 | r.read(integrations) |
---|
| 10 | # get the data out of the reader |
---|
| 11 | scans = r.gettable() |
---|
| 12 | # close the reader |
---|
| 13 | r = None |
---|
| 14 | # print a short summary of the data |
---|
| 15 | scans.summary() |
---|
| 16 | # get the scan with the number '1' |
---|
| 17 | scan = scans.getscan(1) |
---|
| 18 | # get the scan with the number '1' |
---|
| 19 | ref = scans.getscan(2) |
---|
| 20 | # close the data table |
---|
| 21 | scans = None |
---|
| 22 | # open the math server |
---|
| 23 | m = sdmath() |
---|
| 24 | # average the "on" scan |
---|
| 25 | scanav = m.average(scan) |
---|
| 26 | # get rid of the original scan |
---|
| 27 | scan = None |
---|
| 28 | # print a summary of the scan |
---|
| 29 | scanav.summary() |
---|
| 30 | # average the "off" scan |
---|
| 31 | refav = m.average(ref) |
---|
| 32 | # get rid of the original scan |
---|
| 33 | ref = None |
---|
| 34 | # print a summary of the scan |
---|
| 35 | refav.summary() |
---|
| 36 | # form the quotione spectrum |
---|
| 37 | quot = m.quotient(scanav,refav) |
---|
| 38 | # set the cursor to polarisation 0 |
---|
| 39 | quot.setpol(0) |
---|
| 40 | # get the spectrum for polarisation 0 |
---|
| 41 | v0 = quot.getspectrum() |
---|
| 42 | #print the first ten channel |
---|
| 43 | print v0[0:10] |
---|
| 44 | # set the cursor to polarisation 0 |
---|
| 45 | quot.setpol(1) |
---|
| 46 | # get the spectrum for polarisation 0 |
---|
| 47 | v1 = quot.getspectrum() |
---|
| 48 | #print the first ten channel |
---|
| 49 | print v1[0:10] |
---|
| 50 | # write it to disk for further use |
---|
| 51 | quot.makepersistent('/tmp/myfirstquotient.tbl') |
---|
Note: See
TracBrowser
for help on using the repository browser.