source: trunk/examples/test.py@ 905

Last change on this file since 905 was 656, checked in by mar637, 19 years ago

* empty log message *

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