- Timestamp:
- 01/21/05 22:33:45 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapfitter.py
r190 r259 1 1 import _asap 2 from asap import rcParams 2 3 3 4 class fitter: … … 80 81 """ 81 82 #default poly order 0 82 self.fitfunc = 'poly'83 n=0 83 84 84 85 if kwargs.has_key('poly'): 85 86 self.fitfunc = 'poly' … … 110 111 else: 111 112 if self.data is not None: 112 self.x = self.data. getabcissa()113 self.y = self.data. getspectrum()113 self.x = self.data._getabcissa() 114 self.y = self.data._getspectrum() 114 115 print "Fitting:" 115 vb = self.data._v erbose116 self.data._v erbose(True)117 s = self.data.get_ selection()118 self.data._v erbose(vb)116 vb = self.data._vb 117 self.data._vb = True 118 s = self.data.get_cursor() 119 self.data._vb = vb 119 120 120 121 self.fitter.setdata(self.x,self.y,self.mask) … … 213 214 return 214 215 scan = self.data.copy() 215 scan. setspectrum(self.fitter.getresidual())216 scan._setspectrum(self.fitter.getresidual()) 216 217 217 218 def plot(self, residual=False): … … 235 236 if self.data: 236 237 tlab = self.data._getsourcename(0) 237 xlab = self.data. getabcissalabel(0)238 xlab = self.data._getabcissalabel(0) 238 239 ylab = r'Flux' 239 240 m = self.data.getmask(0) … … 252 253 253 254 254 def auto_fit(self ):255 def auto_fit(self, insitu=None): 255 256 """ 256 257 Return a scan where the function is applied to all rows for all Beams/IFs/Pols. … … 261 262 print "Only works with scantables" 262 263 return 263 scan = self.data.copy() 264 vb = scan._verbose 265 scan._verbose(False) 266 sel = scan.get_selection() 264 if insitu is None: insitu = rcParams['insitu'] 265 if not insitu: 266 scan = self.data.copy() 267 else: 268 scan = self.data 269 vb = scan._vb 270 scan._vb = False 271 sel = scan.get_cursor() 267 272 rows = range(scan.nrow()) 268 273 for i in range(scan.nbeam()): … … 276 281 print 'Beam[%d], IF[%d], Pol[%d]' % (i,j,k) 277 282 for iRow in rows: 278 self.x = scan. getabcissa(iRow)279 self.y = scan. getspectrum(iRow)283 self.x = scan._getabcissa(iRow) 284 self.y = scan._getspectrum(iRow) 280 285 self.data = None 281 286 self.fit() 282 287 x = self.get_parameters() 283 scan.setspectrum(self.fitter.getresidual(),iRow) 284 scan.set_selection(sel[0],sel[1],sel[2]) 285 scan._verbose(vb) 286 return scan 288 scan._setspectrum(self.fitter.getresidual(),iRow) 289 scan.set_cursor(sel[0],sel[1],sel[2]) 290 scan._vb = vb 291 if not insitu: 292 return scan
Note:
See TracChangeset
for help on using the changeset viewer.