Changeset 907 for trunk/python/asaplinefind.py
- Timestamp:
- 03/20/06 15:17:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asaplinefind.py
r889 r907 7 7 Example: 8 8 fl=linefinder() 9 fl.set_scan(sc ,edge=(50,))9 fl.set_scan(sc) 10 10 fl.set_options(threshold=3) 11 nlines=fl.find_lines( )11 nlines=fl.find_lines(edge=(50,0)) 12 12 if nlines!=0: 13 13 print "Found ",nlines," spectral lines" … … 65 65 return 66 66 67 def set_scan(self, scan , mask=None, edge=(0,0)):67 def set_scan(self, scan): 68 68 """ 69 69 Set the 'data' (scantable) to work with. 70 70 Parameters: 71 71 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 75 84 specified, the same number will be dropped from 76 85 both sides of the spectrum. Default is to keep 77 86 all channels 87 A number of lines found will be returned 78 88 """ 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 84 89 if isinstance(edge,int): 85 90 edge=(edge,) … … 96 101 if mask is None: 97 102 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) 99 104 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) 109 106 def get_mask(self,invert=False): 110 107 """
Note: See TracChangeset
for help on using the changeset viewer.