Last change
on this file since 72 was 63, checked in by mcalabre, 20 years ago |
sdreader.gettable() renamed to sdreader.getdata().
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
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.getdata()
|
---|
12 | # close the reader
|
---|
13 | r = None
|
---|
14 |
|
---|
15 | # Test sdwriter.
|
---|
16 | print 'Begin sdwriter tests...'
|
---|
17 | # Create an MS2 writer.
|
---|
18 | w = sdwriter('MS2')
|
---|
19 | # Change to SDFITS output format (the default).
|
---|
20 | w.setformat()
|
---|
21 | # Write out the spectra.
|
---|
22 | w.write(scans, 'test_SDWriter.sdfits')
|
---|
23 |
|
---|
24 | # print a short summary of the data
|
---|
25 | scans.summary()
|
---|
26 | # get the scan with the number '1'
|
---|
27 | scan = scans.getscan(1)
|
---|
28 | # get the scan with the number '1'
|
---|
29 | ref = scans.getscan(2)
|
---|
30 | # close the data table
|
---|
31 | scans = None
|
---|
32 | # open the math server
|
---|
33 | m = sdmath()
|
---|
34 | # average the "on" scan
|
---|
35 | scanav = m.average(scan)
|
---|
36 | # get rid of the original scan
|
---|
37 | scan = None
|
---|
38 | # print a summary of the scan
|
---|
39 | scanav.summary()
|
---|
40 | # average the "off" scan
|
---|
41 | refav = m.average(ref)
|
---|
42 | # get rid of the original scan
|
---|
43 | ref = None
|
---|
44 | # print a summary of the scan
|
---|
45 | refav.summary()
|
---|
46 | # form the quotione spectrum
|
---|
47 | quot = m.quotient(scanav,refav)
|
---|
48 | # set the cursor to polarisation 0
|
---|
49 | quot.setpol(0)
|
---|
50 | # get the spectrum for polarisation 0
|
---|
51 | v0 = quot.getspectrum()
|
---|
52 | #print the first ten channel
|
---|
53 | print v0[0:10]
|
---|
54 | # set the cursor to polarisation 0
|
---|
55 | quot.setpol(1)
|
---|
56 | # get the spectrum for polarisation 0
|
---|
57 | v1 = quot.getspectrum()
|
---|
58 | #print the first ten channel
|
---|
59 | print v1[0:10]
|
---|
60 | # write it to disk for further use
|
---|
61 | quot.makepersistent('/tmp/myfirstquotient.tbl')
|
---|
Note:
See
TracBrowser
for help on using the repository browser.