Changeset 1217 for trunk/python
- Timestamp:
- 08/30/06 13:29:25 (18 years ago)
- Location:
- trunk/python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapfitter.py
r1134 r1217 217 217 return 218 218 219 def set_gauss_parameters(self, peak, centre, f hwm,219 def set_gauss_parameters(self, peak, centre, fwhm, 220 220 peakfixed=0, centerfixed=0, 221 f hwmfixed=0,221 fwhmfixed=0, 222 222 component=0): 223 223 """ … … 227 227 peakfixed, 228 228 centerfixed, 229 f hwmfixed: Optional parameters to indicate if229 fwhmfixed: Optional parameters to indicate if 230 230 the paramters should be held fixed during 231 231 the fitting process. The default is to keep … … 242 242 raise ValueError(msg) 243 243 if 0 <= component < len(self.components): 244 d = {'params':[peak, centre, f hwm],245 'fixed':[peakfixed, centerfixed, f hwmfixed]}244 d = {'params':[peak, centre, fwhm], 245 'fixed':[peakfixed, centerfixed, fwhmfixed]} 246 246 self.set_parameters(d, component) 247 247 else: … … 479 479 xlab = 'Abcissa' 480 480 ylab = 'Ordinate' 481 m = None 481 from matplotlib.numerix import ma,logical_not,array 482 m = NUM.ones(len(self.x)) 483 482 484 if self.data: 483 485 tlab = self.data._getsourcename(self._fittedrow) … … 489 491 self._p.palette(0,colours) 490 492 self._p.set_line(label='Spectrum') 491 from matplotlib.numerix import ma,logical_not,array492 493 y = ma.masked_array(self.y,mask=logical_not(array(m,copy=False))) 493 494 self._p.plot(self.x, y) -
trunk/python/asapplotter.py
r1175 r1217 2 2 from asap import NUM 3 3 import matplotlib.axes 4 import sre 4 5 5 6 class asapplotter: … … 153 154 Parameters: 154 155 stacking: tell the plotter which variable to plot 155 as line colo r overlays (default 'pol')156 as line colour overlays (default 'pol') 156 157 panelling: tell the plotter which variable to plot 157 158 across multiple panels (default 'scan' … … 329 330 return 330 331 331 def set_colors(self, col ormap):332 """ 333 Set the colo rs to be used. The plotter will cycle through334 these colo rs when lines are overlaid (stacking mode).335 Parameters: 336 col ormap: a list of colour names332 def set_colors(self, colmap): 333 """ 334 Set the colours to be used. The plotter will cycle through 335 these colours when lines are overlaid (stacking mode). 336 Parameters: 337 colmap: a list of colour names 337 338 Example: 338 339 plotter.set_colors("red green blue") … … 341 342 # and 'V' will be 'red' again. 342 343 """ 343 if isinstance(colormap,str): 344 colormap = colormap.split() 345 self._plotter.palette(0,colormap=colormap) 346 if self._data: self.plot(self._data) 344 if isinstance(colmap,str): 345 colmap = colmap.split() 346 self._plotter.palette(0, colormap=colmap) 347 if self._data: self.plot(self._data) 348 349 # alias for english speakers 350 set_colours = set_colors 347 351 348 352 def set_histogram(self, hist=True, linewidth=None): -
trunk/python/scantable.py
r1203 r1217 923 923 Otherwise, the scaling is done in-situ 924 924 The default is taken from .asaprc (False) 925 allaxes: if True apply to all spectra. Otherwise926 apply only to the selected (beam/pol/if)spectra only927 The default is taken from .asaprc (True if none)928 925 """ 929 926 if insitu is None: insitu = rcParams['insitu'] … … 1184 1181 mask = list(NUM.ones(self.nchan(-1))) 1185 1182 from asap.asapfitter import fitter 1186 f = fitter() 1187 f.set_scan(self, mask) 1188 f.set_function(poly=order) 1189 s = f.auto_fit(insitu, plot=plot) 1190 s._add_history("poly_baseline", varlist) 1191 print_log() 1192 if insitu: self._assign(s) 1193 else: return s 1183 try: 1184 f = fitter() 1185 f.set_scan(self, mask) 1186 f.set_function(poly=order) 1187 s = f.auto_fit(insitu, plot=plot) 1188 s._add_history("poly_baseline", varlist) 1189 print_log() 1190 if insitu: self._assign(s) 1191 else: return s 1192 except RuntimeError: 1193 msg = "The fit failed, possibly because it didn't converge." 1194 if rcParams['verbose']: 1195 print msg 1196 return 1197 else: 1198 raise RuntimeError(msg) 1199 1194 1200 1195 1201 def auto_poly_baseline(self, mask=[], edge=(0, 0), order=0, … … 1433 1439 preserve: Output = Toff * (on/off) - Toff 1434 1440 remove: Output = Toff * (on/off) - Ton 1435 """1441 """ 1436 1442 if mask is None: mask = () 1437 1443 varlist = vars() … … 1439 1445 preoff = scantable(self._math._mx_extract(self, 'off')) 1440 1446 off = preoff.average_time(mask=mask, weight=weight, scanav=False) 1441 from asapmath import quotient1447 from asapmath import quotient 1442 1448 q = quotient(on, off, preserve) 1443 1449 q._add_history("mx_quotient", varlist) 1444 1450 print_log() 1445 return q1451 return q 1446 1452 1447 1453 def freq_switch(self, insitu=None):
Note:
See TracChangeset
for help on using the changeset viewer.