Changeset 2324 for trunk/python
- Timestamp:
- 10/05/11 11:00:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/customgui_base.py
r2172 r2324 176 176 if self.lastspan: self._remove_span(self.lastspan) 177 177 178 self.lastspan = self._draw_span(self._thisregion['axes'],self._thisregion['xs'],xnow,fill="") 178 self.lastspan = self._draw_span(self._thisregion['axes'], 179 self._thisregion['xs'], xnow, fill="") 179 180 del xnow 180 181 … … 217 218 218 219 def _subplot_stats(self,selection): 219 #from numpy import ma, ndarray220 import numpy221 220 statstr = ['max', 'min', 'median', 'mean', 'sum', 'std'] #'rms'] 222 221 panelstr = selection['axes'].title.get_text() … … 225 224 asaplog.post() 226 225 for line in selection['axes'].lines: 226 # Don't include annotations 227 if line.get_label().startswith("_"): 228 continue 227 229 label = panelstr + ", "+line.get_label() 228 230 x = line.get_xdata() 229 selmsk = self._create_flag_from_array(x,selection['worldx'],selection['invert']) 231 newmsk = None 232 selmsk = self._create_flag_from_array(x, 233 selection['worldx'], 234 selection['invert']) 235 ydat = None 230 236 y = line.get_ydata() 231 if isinstance(y,numpy.ma.masked_array):237 if numpy.ma.isMaskedArray(y): 232 238 ydat = y.data 233 239 basemsk = y.mask … … 237 243 if not isinstance(basemsk, bool): 238 244 # should be ndarray 239 newmsk = mask_or(selmsk, basemsk)245 newmsk = mask_or(selmsk, basemsk) 240 246 elif basemsk: 241 247 # the whole original spectrum is flagged … … 244 250 # no channel was flagged originally 245 251 newmsk = selmsk 246 mdata = numpy.ma.masked_array(ydat,mask=newmsk) 247 del x, y, ydat, basemsk, selmsk, newmsk 252 mdata = numpy.ma.masked_array(ydat, mask=newmsk) 248 253 statval = {} 249 254 for stat in statstr: 250 statval[stat] = getattr(numpy,stat)(mdata) 251 self._print_stats(statval,statstr=statstr,label=label,\ 255 # need to get the stat functions from the ma module!!! 256 statval[stat] = getattr(numpy.ma,stat)(mdata) 257 self._print_stats(statval, statstr=statstr, label=label,\ 252 258 mask=selection['worldx'],\ 253 259 unmask=selection['invert']) 254 260 asaplog.push(ssep) 255 261 asaplog.post() 256 del mdata, statval257 del ssep, panelstr258 262 259 263 def _create_flag_from_array(self,x,masklist,invert): … … 297 301 sout += ("%f "*len(statstr) % tuple(statvals)) 298 302 asaplog.push(sout) 299 del sout, maskstr, masktype, statvals, key, stats, statstr, mask, label303 #del sout, maskstr, masktype, statvals, key, stats, statstr, mask, label 300 304 301 305 … … 1077 1081 statval = {} 1078 1082 statstr = ['max', 'min', 'mean', 'median', 'sum', 'stddev', 'rms'] 1079 if isinstance(rows, list) and len(rows) > 0:1083 if isinstance(rows, list) and len(rows) > 0: 1080 1084 for irow in rows: 1081 1085 for stat in statstr: … … 1095 1099 for stat in statstr: 1096 1100 statval[stat] = mathobj._statsrow(scan,mask,stat,irow)[0] 1097 self._print_stats(scan,irow,statval,statstr=statstr,mask=masklist) 1101 self._print_stats(scan,irow,statval,statstr=statstr, 1102 mask=masklist) 1098 1103 del irow, mask 1099 1104 del srow, masklist
Note:
See TracChangeset
for help on using the changeset viewer.