Changeset 1061 for trunk/python
- Timestamp:
- 06/08/06 13:59:51 (18 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapfitter.py
r1039 r1061 322 322 fix = "" 323 323 if fixed[i]: fix = "(fixed)" 324 out += ' p%d%s= %3. 3f,' % (c,fix,pars[i])324 out += ' p%d%s= %3.6f,' % (c,fix,pars[i]) 325 325 c+=1 326 326 out = out[:-1] # remove trailing ',' … … 491 491 print_log() 492 492 493 def auto_fit(self, insitu=None ):493 def auto_fit(self, insitu=None, plot=False): 494 494 """ 495 495 Return a scan where the function is applied to all rows for … … 521 521 self.fit() 522 522 x = self.get_parameters() 523 if plot: 524 self.plot(residual=True) 525 x = raw_input("Accept fit ([y]/n): ") 526 if x.upper() == 'N': 527 continue 523 528 scan._setspectrum(self.fitter.getresidual(), r) 529 if plot: 530 self._p.unmap() 531 self._p = None 524 532 print_log() 525 533 return scan -
trunk/python/scantable.py
r1033 r1061 1033 1033 1034 1034 1035 def poly_baseline(self, mask=None, order=0, insitu=None):1035 def poly_baseline(self, mask=None, order=0, plot=False, insitu=None): 1036 1036 """ 1037 1037 Return a scan which has been baselined (all rows) by a polynomial. … … 1040 1040 mask: an optional mask 1041 1041 order: the order of the polynomial (default is 0) 1042 plot: plot the fit and the residual. In this each 1043 indivual fit has to be approved, by typing 'y' 1044 or 'n' 1042 1045 insitu: if False a new scantable is returned. 1043 1046 Otherwise, the scaling is done in-situ 1044 1047 The default is taken from .asaprc (False) 1045 allaxes: If True (default) apply to all spectra. Otherwise1046 apply only to the selected (beam/pol/if)spectra only1047 The default is taken from .asaprc (True if none)1048 1048 Example: 1049 1049 # return a scan baselined by a third order polynomial, … … 1060 1060 f.set_scan(self, mask) 1061 1061 f.set_function(poly=order) 1062 s = f.auto_fit(insitu )1062 s = f.auto_fit(insitu, plot=plot) 1063 1063 s._add_history("poly_baseline", varlist) 1064 1064 print_log() … … 1067 1067 1068 1068 def auto_poly_baseline(self, mask=[], edge=(0,0), order=0, 1069 threshold=3, insitu=None):1069 threshold=3, plot=False, insitu=None): 1070 1070 """ 1071 1071 Return a scan which has been baselined (all rows) by a polynomial. … … 1086 1086 keep it large as only strong lines affect the 1087 1087 baseline solution. 1088 plot: plot the fit and the residual. In this each 1089 indivual fit has to be approved, by typing 'y' 1090 or 'n' 1088 1091 insitu: if False a new scantable is returned. 1089 1092 Otherwise, the scaling is done in-situ … … 1155 1158 f.fit() 1156 1159 x = f.get_parameters() 1160 if plot: 1161 f.plot(residual=True) 1162 x = raw_input("Accept fit ( [y]/n ): ") 1163 if x.upper() == 'N': 1164 continue 1157 1165 workscan._setspectrum(f.fitter.getresidual(), r) 1158 workscan._add_history("poly_baseline", varlist) 1166 if plot: 1167 f._p.unmap() 1168 f._p = None 1169 workscan._add_history("auto_poly_baseline", varlist) 1159 1170 if insitu: 1160 1171 self._assign(workscan)
Note:
See TracChangeset
for help on using the changeset viewer.