Changeset 2606 for trunk/python/flagplotter.py
- Timestamp:
- 07/23/12 18:28:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/flagplotter.py
r2605 r2606 32 32 self.set_stacking('scan') 33 33 self._ismodified = False 34 self._showflag = True #False34 self._showflagged = False 35 35 self.set_colors("blue gray",False) 36 36 … … 51 51 asaplog.post("ERROR") 52 52 53 def set_showflag (self, show):53 def set_showflagged(self, show): 54 54 """ Whether or not plotting flagged data""" 55 55 if type(show) == bool: 56 self._showflag = show 56 self._showflagged = show 57 print "self._showflagged =", str(show) 58 else: 59 raise TypeError, "Input parameter should be a bool." 57 60 58 61 @asaplog_post_dec … … 130 133 if self._is_new_scan(scan): 131 134 self._ismodified = False 132 if not self._showflag :135 if not self._showflagged: 133 136 self.set_legend(mode=None,refresh=False) 134 137 elif not self._legendloc: … … 139 142 @asaplog_post_dec 140 143 def _plot(self, scan): 141 self._plot_with_flag(scan,self._showflag) 144 self._plot_with_flag(scan,self._showflagged) 145 #asapplotter._plot(self,scan) 142 146 # rescale x-range of subplots 5% margins 143 147 ganged = (self._plotter.axes._sharex != None) … … 156 160 157 161 @asaplog_post_dec 158 def _plot_with_flag(self, scan, showflag= True):162 def _plot_with_flag(self, scan, showflag=False): 159 163 # total number of panles to plot as a whole 160 164 nptot = scan.nrow() … … 180 184 nr = scan.nrow() 181 185 panelcount = 0 182 186 allylim = [] 187 allxlim = [] 188 183 189 while r < nr: 184 190 # always plot to new panel … … 205 211 # Now get data to plot 206 212 y = scan._getspectrum(r) 207 # flag row213 # Check for FLAGROW column 208 214 mr = scan._getflagrow(r) 209 215 from numpy import ma, array … … 225 231 if self._offset: 226 232 x += self._offset 227 llbl = self._get_label(scan, r, mode='legend', userlabel=self._lmap) 228 if type(llbl) in (list, tuple): 229 llbl = llbl[0] 230 self._plotter.set_line(label=llbl) 231 plotit = self._plotter.plot 232 if self._hist: plotit = self._plotter.hist 233 plotit(x,ys) 233 #llbl = self._get_label(scan, r, mode='legend', userlabel=self._lmap) 234 #if type(llbl) in (list, tuple): 235 # llbl = llbl[0] 236 #self._plotter.set_line(label=llbl) 237 self._plotter.set_line(label="data") 238 #plotit = self._plotter.plot 239 #if self._hist: plotit = self._plotter.hist 240 self._plotter.plot(x,ys) 234 241 if showflag: 235 242 self._plotter.set_line(label="flagged") 236 plotit(x,yf) 243 self._plotter.plot(x,yf) 244 ylim = self._minmaxy or [min(y),max(y)] 245 xlim= self._minmaxx or [min(x),max(x)] 246 elif mr or ys.mask.all(): 247 ylim = self._minmaxy or [] 248 xlim = self._minmaxx or [] 249 else: 250 ylim = self._minmaxy or [ma.minimum(ys),ma.maximum(ys)] 251 xlim= self._minmaxx or [min(x),max(x)] 252 allylim += ylim 253 allxlim += xlim 237 254 if (panelcount == n) or (r == nr-1): 238 255 break 239 256 r+=1 # next row 240 257 258 # Set x- and y- limts of subplots 259 if ganged: 260 xlim = None 261 ylim = None 262 if len(allylim) > 0: 263 allylim.sort() 264 ylim = allylim[0],allylim[-1] 265 if len(allxlim) > 0: 266 allxlim.sort() 267 xlim = allxlim[0],allxlim[-1] 268 self._plotter.set_limits(xlim=xlim,ylim=ylim) 241 269 242 270 # save the current counter for multi-page plotting
Note: See TracChangeset
for help on using the changeset viewer.