source: trunk/examples/test.py@ 509

Last change on this file since 509 was 266, checked in by kil064, 20 years ago

getspectrum -> _getspectrum

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
RevLine 
[76]1#import genera operating system related functions
2import os
[84]3#import asap module
4from asap import *
[115]5# create a readersa and open an RPFITS file
6r = reader('/u/mmarquar/zorro/singledish/data/2001-09-01_0332_P363.rpf')
[20]7# create a vector with numbers [0..109]
8integrations = range(110)
9# get the data out of the reader
[115]10scans = r.read(integrations)
[20]11# close the reader
12r = None
[115]13print 'Begin export test...'
14# Write out the spectra in SDFITS format
15scans.save('/tmp/test_SDWriter.sdfits','SDFITS')
[76]16# clean up
17print "removing test_SDWriter.sdfits ..."
[84]18os.remove('/tmp/test_SDWriter.sdfits')
[20]19# print a short summary of the data
20scans.summary()
[115]21# get the scan with the number '0'
22scan = scans.get_scan(0)
23# get the scan with the name 'ref_R'
24ref = scans.get_scan('ref_R')
[20]25# close the data table
26scans = None
27# open the math server
28# average the "on" scan
[115]29scanav = average_time(scan)
[20]30# get rid of the original scan
31scan = None
32# print a summary of the scan
33scanav.summary()
34# average the "off" scan
[115]35refav = average_time(ref)
[20]36# get rid of the original scan
37ref = None
38# print a summary of the scan
39refav.summary()
40# form the quotione spectrum
[76]41quot = quotient(scanav,refav)
[20]42# set the cursor to polarisation 0
[265]43quot.set_cursor(thepol=0)
[20]44# get the spectrum for polarisation 0
[266]45v0 = quot._getspectrum()
[20]46#print the first ten channel
47print v0[0:10]
[76]48# set the cursor to polarisation 1
[265]49quot.set_cursor(thepol=1)
[76]50# get the spectrum for polarisation 1
[266]51v1 = quot._getspectrum()
[20]52#print the first ten channel
53print v1[0:10]
54# write it to disk for further use
[115]55quot.save('/tmp/myfirstquotient.asap')
[76]56# cleanup
[115]57print "removing /tmp/myfirstquotient.asap ..."
58os.system('rm -rf /tmp/myfirstquotient.asap')
[76]59print "Test successful."
Note: See TracBrowser for help on using the repository browser.