source: trunk/python/asapreader.py @ 109

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

initial revision of the python asap reader class

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 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    Available functions are:
8
9    read(integrations)
10    summary    CURRENTLY DISABLED
11
12    Example:
13        r = reader('/tmp/P389.rpf')
14        scans r.read() # reads in the complete file into 'scans'
15        print scans    # summarises the contents
16        del r          # destroys the reader
17    """
18
19    def __init__(self, filename):
20        """
21        Parameters:
22            filename:    the name of an rpfits/sdfits/ms file on disk
23        Example:
24            r = reader('/tmp/2001-09-01_0332_P363.rpf')
25        """
26        sdreader.__init__(self, filename)
27
28    def read(self,integrations=None):
29        """
30        Reads in an returns a specified sequence of integrations.
31        If no list is given all integrations a read in.
32        Parameters:
33            integrations:    a 'range' of integration numbers, e.g.
34                             range(100) or [0,1,2,3,4,10,11,100]
35        Example:
36            r.read([0,1,2,3,4])    # reads in the first 5 integatrions
37                                   # NOT scans
38            r.read(range(100))     # read in the first 100 integrations
39        """
40        from asap import scantable
41        if integrations is None:
42            integrations = [-1]
43        sdreader.read(self,integrations)
44        tbl = sdreader.getdata(self)
45        return scantable(tbl)
46
47    def summary(self):
48        print "Disabled"
49        return
50        sdreader.reset(self)
51        sdreader.read([-1])
52        sdreader.reset(self)
53        tbl = sdreader.getdata(self)
54        print tbl.summary()
Note: See TracBrowser for help on using the repository browser.