source: branches/alma/python/asapreader.py@ 2812

Last change on this file since 2812 was 1782, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: No (merge)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): single dish package

Description:

Merged some unimplemented developments from the trunk.
[Details]

  1. Restored PKSmsg.cc, PKSmsg.h to alma branch from trunk
  2. Updated pks_matchs.cc and src/SConscript to ones in trunk
  3. uncommented "@print_log_dec"
  4. implemented bug fixes to add(), sub(), mul(), and div() in scantable.py
  5. implemented get_region() and get_point() in asaplotbase.py
  6. activated interactive keyword for text(), arrow(), annotate(), axvline(), axhline(), axvspan(), and axhspan() in asapplotter.py


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
RevLine 
[895]1from asap._asap import stfiller
[1757]2from asap import print_log, print_log_dec
[103]3
[895]4class reader(stfiller):
[103]5 """
6 This class allows the user to import single dish files
7 (rpfits,sdfits,ms).
[1059]8 The reader reads in integrations from the file and remains at
[113]9 the fileposition afterwards.
[103]10 Available functions are:
11
[1059]12 read() # read until the (current) end of file)
[103]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
[415]19
20 IMPORTANT: Due to limitations in the rpfits library, only one reader
21 can be created at a time.
22 r = reader('XYZ.rpf')
23 r2 = reader('ABC.rpf')
24 is NOT possible. This is a limitation affecting
25 rpfits ONLY.
[103]26 """
[1782]27 @print_log_dec
[341]28 def __init__(self, filename, unit=None, theif=None, thebeam=None):
29 self.unit = unit
[103]30 """
31 Parameters:
32 filename: the name of an rpfits/sdfits/ms file on disk
[339]33 unit: brightness unit; must be consistent with K or Jy.
34 The default is that a unit is set depending on
35 the telescope. Setting this over-rides that choice.
[333]36 theif: select a specific IF (default is all)
37 thebeam: select a specific beam (default is all)
[103]38 Example:
[333]39 r = reader('/tmp/2001-09-01_0332_P363.rpf', theif=2)
[103]40 """
[333]41 if theif is None:
42 theif = -1
43 if thebeam is None:
44 thebeam = -1
[411]45 from os.path import expandvars
46 filename = expandvars(filename)
[895]47 stfiller.__init__(self, filename, theif, thebeam)
[719]48 print_log()
[103]49
[1782]50 @print_log_dec
[895]51 def read(self):
[103]52 """
[1059]53 Reads in all integrations in the data file.
[103]54 """
55 from asap import scantable
[719]56 from asap import asaplog
57 asaplog.push("Reading integrations from disk...")
[895]58 stfiller._read(self)
59 tbl = stfiller._getdata(self)
[341]60 if self.unit is not None:
61 tbl.set_fluxunit(self.unit)
[719]62 print_log()
[103]63 return scantable(tbl)
64
[895]65 def close(self):
66 """
67 Close the reader.
68 """
69 self._close()
70
[411]71 def summary(self, name=None):
[113]72 """
73 Print a summary of all scans/integrations. This reads through the
74 whole file once.
75 Parameters:
76 None
77 Example:
78 r.summary()
79 """
[895]80 stfiller._read(self)
[411]81 from asap import scantable
[895]82 tbl = scantable(stfiller._getdata(self))
[415]83 tbl.summary(name)
[895]84 del tbl
[113]85 return
Note: See TracBrowser for help on using the repository browser.