source: trunk/examples/test.py@ 30

Last change on this file since 30 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
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.gettable()
12# close the reader
13r = None
14# print a short summary of the data
15scans.summary()
16# get the scan with the number '1'
17scan = scans.getscan(1)
18# get the scan with the number '1'
19ref = scans.getscan(2)
20# close the data table
21scans = None
22# open the math server
23m = sdmath()
24# average the "on" scan
25scanav = m.average(scan)
26# get rid of the original scan
27scan = None
28# print a summary of the scan
29scanav.summary()
30# average the "off" scan
31refav = m.average(ref)
32# get rid of the original scan
33ref = None
34# print a summary of the scan
35refav.summary()
36# form the quotione spectrum
37quot = m.quotient(scanav,refav)
38# set the cursor to polarisation 0
39quot.setpol(0)
40# get the spectrum for polarisation 0
41v0 = quot.getspectrum()
42#print the first ten channel
43print v0[0:10]
44# set the cursor to polarisation 0
45quot.setpol(1)
46# get the spectrum for polarisation 0
47v1 = quot.getspectrum()
48#print the first ten channel
49print v1[0:10]
50# write it to disk for further use
51quot.makepersistent('/tmp/myfirstquotient.tbl')
Note: See TracBrowser for help on using the repository browser.