Changeset 76
- Timestamp:
- 07/30/04 13:32:50 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/test.py
r63 r76 1 #import genera operating system related functions 2 import os 1 3 #import atnf_sd module 2 4 from atnf_sd import * … … 12 14 # close the reader 13 15 r = None 14 15 16 # Test sdwriter. 16 17 print 'Begin sdwriter tests...' … … 21 22 # Write out the spectra. 22 23 w.write(scans, 'test_SDWriter.sdfits') 23 24 # clean up 25 print "removing test_SDWriter.sdfits ..." 26 os.remove('test_SDWriter.sdfits') 24 27 # print a short summary of the data 25 28 scans.summary() 26 29 # get the scan with the number '1' 27 scan = scans.getscan( 1)30 scan = scans.getscan(0) 28 31 # get the scan with the number '1' 29 ref = scans.getscan( 2)32 ref = scans.getscan(1) 30 33 # close the data table 31 34 scans = None 32 35 # open the math server 33 m = sdmath()34 36 # average the "on" scan 35 scanav = m.average(scan)37 scanav = average(scan) 36 38 # get rid of the original scan 37 39 scan = None … … 39 41 scanav.summary() 40 42 # average the "off" scan 41 refav = m.average(ref)43 refav = average(ref) 42 44 # get rid of the original scan 43 45 ref = None … … 45 47 refav.summary() 46 48 # form the quotione spectrum 47 quot = m.quotient(scanav,refav)49 quot = quotient(scanav,refav) 48 50 # set the cursor to polarisation 0 49 51 quot.setpol(0) … … 52 54 #print the first ten channel 53 55 print v0[0:10] 54 # set the cursor to polarisation 056 # set the cursor to polarisation 1 55 57 quot.setpol(1) 56 # get the spectrum for polarisation 058 # get the spectrum for polarisation 1 57 59 v1 = quot.getspectrum() 58 60 #print the first ten channel … … 60 62 # write it to disk for further use 61 63 quot.makepersistent('/tmp/myfirstquotient.tbl') 64 # cleanup 65 print "removing /tmp/myfirstquotient.tbl ..." 66 os.system('rm -rf /tmp/myfirstquotient.tbl') 67 print "Test successful."
Note:
See TracChangeset
for help on using the changeset viewer.