source: trunk/python/asapreader.py@ 116

Last change on this file since 116 was 113, checked in by mar637, 20 years ago

version 0.1a

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1from asap._asap import sdreader
2
3class reader(sdreader):
4 """
5 This class allows the user to import single dish files
6 (rpfits,sdfits,ms).
7 The reader reads in integrations from the file and reamins at
8 the fileposition afterwards.
9 Available functions are:
10
11 read(integrations)
12 summary CURRENTLY DISABLED
13
14 Example:
15 r = reader('/tmp/P389.rpf')
16 scans r.read() # reads in the complete file into 'scans'
17 print scans # summarises the contents
18 del r # destroys the reader
19 """
20
21 def __init__(self, filename):
22 """
23 Parameters:
24 filename: the name of an rpfits/sdfits/ms file on disk
25 Example:
26 r = reader('/tmp/2001-09-01_0332_P363.rpf')
27 """
28 sdreader.__init__(self, filename)
29
30 def read(self,integrations=None):
31 """
32 Reads in an returns a specified sequence of integrations.
33 If no list is given all integrations a read in.
34 Parameters:
35 integrations: a 'range' of integration numbers, e.g.
36 range(100) or [0,1,2,3,4,10,11,100]
37 If not given (default) all integrations
38 are read in
39 Example:
40 r.read([0,1,2,3,4]) # reads in the first 5 integatrions
41 # NOT scans
42 r.read(range(100)) # read in the first 100 integrations
43 """
44 from asap import scantable
45 if integrations is None:
46 integrations = [-1]
47 print "Reading intergrations from disk..."
48 sdreader.read(self,integrations)
49 tbl = sdreader.getdata(self)
50 return scantable(tbl)
51
52 def summary(self):
53 """
54 Print a summary of all scans/integrations. This reads through the
55 whole file once.
56 Parameters:
57 None
58 Example:
59 r.summary()
60 """
61 sdreader.reset(self)
62 sdreader.read(self,[-1])
63 tbl = sdreader.getdata(self)
64 sdreader.reset(self)
65 print tbl.summary()
66 return
Note: See TracBrowser for help on using the repository browser.