Ignore:
Timestamp:
03/20/06 15:17:06 (18 years ago)
Author:
vor010
Message:

LineFinder? & auto_poly_baseline: a support of
new scantable format has been added. Now findLines accept a mask and edge
parameters, which can therefore be different for different rows. Constructor
need now just a scan table. Boost types removed from STLineFinder. auto_poly_baseline can accept a nested tuple of edges, which would be interpreted as
different edge parameters for different IFs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplinefind.py

    r889 r907  
    77    Example:
    88       fl=linefinder()
    9        fl.set_scan(sc,edge=(50,))
     9       fl.set_scan(sc)
    1010       fl.set_options(threshold=3)
    11        nlines=fl.find_lines()
     11       nlines=fl.find_lines(edge=(50,0))
    1212       if nlines!=0:
    1313          print "Found ",nlines," spectral lines"
     
    6565        return
    6666
    67     def set_scan(self, scan, mask=None, edge=(0,0)):
     67    def set_scan(self, scan):
    6868        """
    6969        Set the 'data' (scantable) to work with.
    7070        Parameters:
    7171             scan:    a scantable
    72              mask:       an optional mask retreived from scantable
    73              edge:       an optional number of channel to drop at
    74                          the edge of spectrum. If only one value is
     72        """
     73        if not scan:
     74           raise RuntimeError, 'Please give a correct scan'
     75        return
     76    def find_lines(self,nRow=0,mask=None,edge=(0,0)):
     77        """
     78        Search for spectral lines in the scan assigned in set_scan.
     79        Parameters:
     80             nRow:       a row in the scantable to work with
     81             mask:       an optional mask (e.g. retreived from scantable)
     82             edge:       an optional number of channels to drop at
     83                         the edge of the spectrum. If only one value is
    7584                         specified, the same number will be dropped from
    7685                         both sides of the spectrum. Default is to keep
    7786                         all channels
     87        A number of lines found will be returned
    7888        """
    79         if not scan:
    80            raise RuntimeError, 'Please give a correct scan'
    81         if not scan._check_ifs():
    82            raise RuntimeError, 'IFs with different numbers of channels are not yet supported'
    83 
    8489        if isinstance(edge,int):
    8590           edge=(edge,)
     
    96101        if mask is None:
    97102            from numarray import ones
    98             self.finder.setscan(scan,ones(scan.nchan(-1)),tuple(edge))
     103            return self.finder.findlines(ones(scan.nchan(nRow)),list(edge),nRow)
    99104        else:
    100             self.finder.setscan(scan,mask,tuple(edge))
    101         return
    102     def find_lines(self,nRow=0):
    103         """
    104         Search for spectral lines in the scan assigned in set_scan.
    105         Current Beam/IF/Pol is used, Row is specified by parameter
    106         A number of lines found will be returned
    107         """
    108         return self.finder.findlines(nRow)
     105            return self.finder.setscan(mask,list(edge),nRow)
    109106    def get_mask(self,invert=False):
    110107        """
Note: See TracChangeset for help on using the changeset viewer.