Changeset 76


Ignore:
Timestamp:
07/30/04 13:32:50 (20 years ago)
Author:
mmarquar
Message:

Fixed up getscan, which is now 0-based.
Added removal of output files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/test.py

    r63 r76  
     1#import genera operating system related functions
     2import os
    13#import atnf_sd module
    24from atnf_sd import *
     
    1214# close the reader
    1315r = None
    14 
    1516# Test sdwriter.
    1617print 'Begin sdwriter tests...'
     
    2122# Write out the spectra.
    2223w.write(scans, 'test_SDWriter.sdfits')
    23 
     24# clean up
     25print "removing test_SDWriter.sdfits ..."
     26os.remove('test_SDWriter.sdfits')
    2427# print a short summary of the data
    2528scans.summary()
    2629# get the scan with the number '1'
    27 scan = scans.getscan(1)
     30scan = scans.getscan(0)
    2831# get the scan with the number '1'
    29 ref = scans.getscan(2)
     32ref = scans.getscan(1)
    3033# close the data table
    3134scans = None
    3235# open the math server
    33 m = sdmath()
    3436# average the "on" scan
    35 scanav = m.average(scan)
     37scanav = average(scan)
    3638# get rid of the original scan
    3739scan = None
     
    3941scanav.summary()
    4042# average the "off" scan
    41 refav = m.average(ref)
     43refav = average(ref)
    4244# get rid of the original scan
    4345ref = None
     
    4547refav.summary()
    4648# form the quotione spectrum
    47 quot = m.quotient(scanav,refav)
     49quot = quotient(scanav,refav)
    4850# set the cursor to polarisation 0
    4951quot.setpol(0)
     
    5254#print  the first ten channel
    5355print v0[0:10]
    54 # set the cursor to polarisation 0
     56# set the cursor to polarisation 1
    5557quot.setpol(1)
    56 # get the spectrum for polarisation 0
     58# get the spectrum for polarisation 1
    5759v1 = quot.getspectrum()
    5860#print  the first ten channel
     
    6062# write it to disk for further use
    6163quot.makepersistent('/tmp/myfirstquotient.tbl')
     64# cleanup
     65print "removing /tmp/myfirstquotient.tbl ..."
     66os.system('rm -rf /tmp/myfirstquotient.tbl')
     67print "Test successful."
Note: See TracChangeset for help on using the changeset viewer.