source: trunk/examples/test.py@ 72

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
2from atnf_sd import *
3# create a reader
4r = sdreader()
5# open an RPFITS file
6r.open('/u/mmarquar/zorro/singledish/data/2001-09-01_0332_P363.rpf')
7# create a vector with numbers [0..109]
8integrations = range(110)
9r.read(integrations)
10# get the data out of the reader
11scans = r.getdata()
12# close the reader
13r = None
14
15# Test sdwriter.
16print 'Begin sdwriter tests...'
17# Create an MS2 writer.
18w = sdwriter('MS2')
19# Change to SDFITS output format (the default).
20w.setformat()
21# Write out the spectra.
22w.write(scans, 'test_SDWriter.sdfits')
23
24# print a short summary of the data
25scans.summary()
26# get the scan with the number '1'
27scan = scans.getscan(1)
28# get the scan with the number '1'
29ref = scans.getscan(2)
30# close the data table
31scans = None
32# open the math server
33m = sdmath()
34# average the "on" scan
35scanav = m.average(scan)
36# get rid of the original scan
37scan = None
38# print a summary of the scan
39scanav.summary()
40# average the "off" scan
41refav = m.average(ref)
42# get rid of the original scan
43ref = None
44# print a summary of the scan
45refav.summary()
46# form the quotione spectrum
47quot = m.quotient(scanav,refav)
48# set the cursor to polarisation 0
49quot.setpol(0)
50# get the spectrum for polarisation 0
51v0 = quot.getspectrum()
52#print the first ten channel
53print v0[0:10]
54# set the cursor to polarisation 0
55quot.setpol(1)
56# get the spectrum for polarisation 0
57v1 = quot.getspectrum()
58#print the first ten channel
59print v1[0:10]
60# write it to disk for further use
61quot.makepersistent('/tmp/myfirstquotient.tbl')
Note: See TracBrowser for help on using the repository browser.