- Timestamp:
- 09/20/05 11:18:45 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release-2-fixes/python/asapplotter.py
r671 r672 45 45 self._ordinate = None 46 46 self._abcissa = None 47 self._abcunit = None 47 48 self._cursor = {'t':None, 'b':None, 48 49 'i':None, 'p':None … … 79 80 self._data = list(args) 80 81 self.set_cursor(refresh=False) 82 # ranges become invalid when unit changes 83 if self._abcunit != self._data[0].get_unit(): 84 self._minmaxx = None 85 self._minmaxy = None 86 self._abcunit = self._data[0].get_unit() 81 87 if self._panelling == 't': 82 88 maxrows = 25 … … 93 99 else: 94 100 self._plot_other(self._data, self._stacking) 95 if self._minmax x is not None or self._minmaxy is not None:96 self._plotter.set_limits( xlim=self._minmaxx,ylim=self._minmaxy)101 if self._minmaxy is not None: 102 self._plotter.set_limits(ylim=self._minmaxy) 97 103 self._plotter.release() 98 104 return … … 143 149 if colmode == "p": 144 150 polmode = self._polmode[self._cursor["p"].index(j)] 145 j = jj151 #j = jj 146 152 eval(cdict.get(colmode)) 147 153 x = None … … 179 185 llab = self._ldict.get(colmode)+' '+str(j) 180 186 self._plotter.set_line(label=llab) 187 if self._minmaxx is not None: 188 s,e = self._slice_indeces(x) 189 x = x[s:e] 190 y = y[s:e] 191 m = m[s:e] 181 192 self._plotter.plot(x,y,m) 193 182 194 xlim=[min(x),max(x)] 183 195 self._plotter.axes.set_xlim(xlim) … … 234 246 if colmode == "p": 235 247 polmode = self._polmode[self._cursor["p"].index(j)] 236 j = jj248 #j = jj 237 249 eval(cdict.get(colmode)) 238 250 x = None … … 265 277 llab = self._ldict.get(colmode)+' '+str(j) 266 278 self._plotter.set_line(label=llab) 279 if self._minmaxx is not None: 280 s,e = self._slice_indeces(x) 281 x = x[s:e] 282 y = y[s:e] 283 m = m[s:e] 284 267 285 self._plotter.plot(x,y,m) 268 286 xlim=[min(x),max(x)] … … 384 402 llab = self._ldict.get(colmode)+' '+str(j) 385 403 self._plotter.set_line(label=llab) 404 if self._minmaxx is not None: 405 s,e = self._slice_indeces(x) 406 x = x[s:e] 407 y = y[s:e] 408 m = m[s:e] 409 386 410 self._plotter.plot(x,y,m) 387 411 xlim=[min(x),max(x)] … … 643 667 tlab = scan._getpolarizationlabel(1,0,0) 644 668 return tlab 669 670 def _slice_indeces(self, data): 671 mn = self._minmaxx[0] 672 mx = self._minmaxx[1] 673 asc = data[0] < data[-1] 674 start=0 675 end = len(data)-1 676 inc = 1 677 if not asc: 678 start = len(data)-1 679 end = 0 680 inc = -1 681 # find min index 682 while data[start] < mn: 683 start+= inc 684 # find max index 685 while data[end] > mx: 686 end-=inc 687 end +=1 688 if start > end: 689 return end,start 690 return start,end 645 691 646 692 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.