source: trunk/python/asapreader.py@ 408

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

added missing """ on reset help

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
RevLine 
[103]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).
[113]7 The reader reads in integrations from the file and reamins at
8 the fileposition afterwards.
[103]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
[341]21 def __init__(self, filename, unit=None, theif=None, thebeam=None):
22 self.unit = unit
[103]23 """
24 Parameters:
25 filename: the name of an rpfits/sdfits/ms file on disk
[339]26 unit: brightness unit; must be consistent with K or Jy.
27 The default is that a unit is set depending on
28 the telescope. Setting this over-rides that choice.
[333]29 theif: select a specific IF (default is all)
30 thebeam: select a specific beam (default is all)
[103]31 Example:
[333]32 r = reader('/tmp/2001-09-01_0332_P363.rpf', theif=2)
[103]33 """
[333]34 if theif is None:
35 theif = -1
36 if thebeam is None:
37 thebeam = -1
[341]38 sdreader.__init__(self, filename, theif, thebeam)
[103]39
40 def read(self,integrations=None):
41 """
42 Reads in an returns a specified sequence of integrations.
43 If no list is given all integrations a read in.
44 Parameters:
45 integrations: a 'range' of integration numbers, e.g.
46 range(100) or [0,1,2,3,4,10,11,100]
[113]47 If not given (default) all integrations
48 are read in
[103]49 Example:
50 r.read([0,1,2,3,4]) # reads in the first 5 integatrions
51 # NOT scans
52 r.read(range(100)) # read in the first 100 integrations
53 """
54 from asap import scantable
55 if integrations is None:
56 integrations = [-1]
[127]57 print "Reading integrations from disk..."
[406]58 sdreader._read(self,integrations)
59 tbl = sdreader._getdata(self)
[341]60 if self.unit is not None:
61 tbl.set_fluxunit(self.unit)
[103]62 return scantable(tbl)
63
64 def summary(self):
[113]65 """
66 Print a summary of all scans/integrations. This reads through the
67 whole file once.
68 Parameters:
69 None
70 Example:
71 r.summary()
72 """
[406]73 sdreader._reset(self)
74 sdreader._read(self,[-1])
75 tbl = sdreader._getdata(self)
76 sdreader._reset(self)
[360]77 print tbl._summary()
[113]78 return
[406]79 def reset(self):
80 """
81 Reset to the beginning of the file.
82 Parameters:
83 none
84 Examples:
85 r = reader('xyz.sdfits')
86 scans0 = r.read(range(10))
87 r.reset()
88 scans1 = r.read(range(5,15))
89 # produces 2 scatables one containing integrations(rows) 0-9
90 # and a second one with rows 5-14
[408]91 """
[406]92 sdreader._reset(self)
93
Note: See TracBrowser for help on using the repository browser.