Changeset 1562 for branches/alma/python


Ignore:
Timestamp:
04/08/09 19:20:34 (16 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-1298)

Ready to Release: Yes

Interface Changes: No

What Interface Changed:

Test Programs: run sdplot() with wrong 'sprange' or 'flrange' selections

Put in Release Notes: No

Module(s): tools and tasks which calls sd.plotter.plot()

Description:

Methods plot() and _slice_indeces() are modified to fix bugs in ASAP plotter.
The method _slice_indeces() is modified to avoid index referencing error and
to return precise 'slice indices'.
The method plot() is modified to avoid invalid index referencing when setting
plot range. The y-range of the plot will be set to the default plot range of
Matplotlib, i.e., [0,1], if flrange is not set and the selected sprange is out
of range.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/asapplotter.py

    r1457 r1562  
    556556            inc = -1
    557557        # find min index
    558         while start > 0 and data[start] < mn:
    559             start+= inc
     558        #while start > 0 and data[start] < mn:
     559        #    start+= inc
     560        minind=start
     561        for ind in xrange(start,end+inc,inc):
     562            if data[ind] > mn: break
     563            minind=ind
    560564        # find max index
    561         while end > 0 and data[end] > mx:
    562             end-=inc
    563         if end > 0: end +=1
     565        #while end > 0 and data[end] > mx:
     566        #    end-=inc
     567        #if end > 0: end +=1
     568        maxind=end
     569        for ind in xrange(end,start-inc,-inc):
     570            if data[ind] < mx: break
     571            maxind=ind
     572        start=minind
     573        end=maxind
    564574        if start > end:
    565             return end,start
    566         return start,end
     575            return end,start+1
     576        elif start < end:
     577            return start,end+1
     578        else:
     579            return start,end
    567580
    568581    def _reset(self):
     
    605618        if n > 1:
    606619            ganged = rcParams['plotter.ganged']
    607             ###Start Mod: 2008.09.22 kana ###
    608620            if self._panelling == 'i':
    609621                ganged = False
    610             ###End Mod#######################
    611622            if self._rows and self._cols:
    612623                n = min(n,self._rows*self._cols)
     
    688699                    ylim= self._minmaxy or [ma.minimum(y),ma.maximum(y)]
    689700                    allylim += ylim
     701                else:
     702                    xlim = self._minmaxx or []
     703                    allxlim += xlim
     704                    ylim= self._minmaxy or []
     705                    allylim += ylim
    690706                stackcount += 1
    691707                # last in colour stack -> autoscale x
    692                 if stackcount == nstack:
     708                if stackcount == nstack and len(allxlim) > 0:
    693709                    allxlim.sort()
    694                     ###Start Mod: 2008.09.22 kana ###
    695                     #self._plotter.axes.set_xlim([allxlim[0],allxlim[-1]])
    696710                    self._plotter.subplots[panelcount-1]['axes'].set_xlim([allxlim[0],allxlim[-1]])
    697                     ###End Mod#######################
    698711                    # clear
    699712                    allxlim =[]
     
    705718            if (panelcount == n) and (stackcount == nstack):
    706719                # last panel -> autoscale y if ganged
    707                 if rcParams['plotter.ganged']:
     720                if rcParams['plotter.ganged'] and len(allylim) > 0:
    708721                    allylim.sort()
    709722                    self._plotter.set_limits(ylim=[allylim[0],allylim[-1]])
Note: See TracChangeset for help on using the changeset viewer.