Changeset 1589 for trunk/python/asapfitter.py
- Timestamp:
- 07/02/09 12:17:20 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapfitter.py
r1536 r1589 1 1 import _asap 2 2 from asap import rcParams 3 from asap import print_log 3 from asap import print_log_dec 4 4 from asap import _n_bools 5 5 from asap import mask_and … … 76 76 Set the function to be fit. 77 77 Parameters: 78 poly: use a polynomial of the order given with nonlinear least squares fit 78 poly: use a polynomial of the order given with nonlinear least squares fit 79 79 lpoly: use polynomial of the order given with linear least squares fit 80 80 gauss: fit the number of gaussian specified … … 90 90 n = kwargs.get('poly') 91 91 self.components = [n] 92 self.uselinear = False 92 self.uselinear = False 93 93 elif kwargs.has_key('lpoly'): 94 94 self.fitfunc = 'poly' … … 101 101 self.fitfuncs = [ 'gauss' for i in range(n) ] 102 102 self.components = [ 3 for i in range(n) ] 103 self.uselinear = False 103 self.uselinear = False 104 104 else: 105 105 msg = "Invalid function type." … … 114 114 return 115 115 116 @print_log_dec 116 117 def fit(self, row=0, estimate=False): 117 118 """ … … 150 151 self.data.getbeam(i), 151 152 self.data.getif(i), 152 self.data.getpol(i), 153 self.data.getpol(i), 153 154 self.data.getcycle(i)) 154 155 asaplog.push(out,False) … … 175 176 self._fittedrow = row 176 177 self.fitted = True 177 print_log()178 178 return 179 179 … … 204 204 self.data._addfit(fit,self._fittedrow) 205 205 206 #def set_parameters(self, params, fixed=None, component=None):206 @print_log_dec 207 207 def set_parameters(self,*args,**kwargs): 208 208 """ … … 247 247 if fixed is not None: 248 248 self.fitter.setfixedparameters(fixed) 249 print_log()250 249 return 251 250 … … 461 460 return self.fitter.getfit() 462 461 462 @print_log_dec 463 463 def commit(self): 464 464 """ … … 482 482 scan = self.data.copy() 483 483 scan._setspectrum(self.fitter.getresidual()) 484 print_log()485 484 return scan 486 485 486 @print_log_dec 487 487 def plot(self, residual=False, components=None, plotparms=False, filename=None): 488 488 """ … … 520 520 array(self.data._getmask(self._fittedrow), 521 521 copy=False)) 522 522 523 523 ylab = self.data._get_ordinate_label() 524 524 … … 570 570 if (not rcParams['plotter.gui']): 571 571 self._p.save(filename) 572 print_log() 573 572 573 @print_log_dec 574 574 def auto_fit(self, insitu=None, plot=False): 575 575 """ … … 598 598 scan.getbeam(r), 599 599 scan.getif(r), 600 scan.getpol(r), 600 scan.getpol(r), 601 601 scan.getcycle(r)) 602 602 asaplog.push(out, False) … … 616 616 self._p.unmap() 617 617 self._p = None 618 print_log()619 618 return scan 620
Note: See TracChangeset
for help on using the changeset viewer.