Changeset 150c04a in sasview


Ignore:
Timestamp:
May 2, 2008 5:16:06 PM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2d06beb
Parents:
416223d
Message:

working on the zoom…

Location:
guitools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • guitools/PlotPanel.py

    rddff053 r150c04a  
    3535        # Convert values into the correct scale for a linear transformation 
    3636        # TODO: use proper scale transformers 
     37        loprev = lo 
     38        hiprev = hi 
     39        ptprev = pt 
    3740        if scale=='log': 
    38             lo,hi = math.log10(lo),math.log10(hi) 
     41            #assert lo >0 
     42            if lo > 0 : 
     43                lo = math.log10(lo) 
     44            if hi > 0 : 
     45                hi = math.log10(hi) 
    3946            if pt is not None: pt = math.log10(pt) 
    40      
     47         
    4148        # Compute delta from axis range * %, or 1-% if persent is negative 
    4249        if step > 0: 
     
    5461        # Convert transformed values back to the original scale 
    5562        if scale=='log': 
    56             lo,hi = math.pow(10.,lo),math.pow(10.,hi) 
    57             print "check y axis rescale" 
    58      
     63            #if (lo <= -300) and (hi >= 300): 
     64            if (lo > 0) and (math.log(lo) <= -300): 
     65                lo=loprev 
     66                hi=hiprev 
     67                print "Not possible to scale" 
     68            if (lo == 0) or (lo <= -300): 
     69                lo=loprev 
     70                hi=hiprev 
     71                print "Not possible to scale" 
     72            else: 
     73                lo,hi = math.pow(10.,lo),math.pow(10.,hi) 
     74                #assert lo >0,"lo = %g"%lo 
     75                print "possible to scale" 
     76            
     77        print "these are low and high",lo,hi 
     78 
    5979        return (lo,hi) 
    6080 
     
    137157                if insidex: 
    138158                    xdata,_ = ax.transAxes.inverse_xy_tup((x,y)) 
    139                     #print "xaxis",x,"->",xdata 
     159                    print "xaxis",x,"->",xdata 
    140160                insidey,_ = ax.yaxis.contains(event) 
    141161                if insidey: 
    142162                    _,ydata = ax.transAxes.inverse_xy_tup((x,y)) 
    143                     #print "yaxis",y,"->",ydata 
     163                    print "yaxis",y,"->",ydata 
    144164            if xdata is not None: 
    145165                lo,hi = ax.get_xlim() 
     
    150170                lo,hi = _rescale(lo,hi,step,bal=ydata,scale=ax.get_yscale()) 
    151171                ax.set_ylim((lo,hi)) 
    152  
     172                
    153173        self.canvas.draw_idle() 
    154174 
     
    522542                self.graph.yaxis("$Log %s$" % name,  "%s^{-1}" % units) 
    523543            item.transformView() 
    524         #item.name = self.yscales+" vs " +self.xscales       
     544        #item.name = self.yscales+" vs " +self.xscales   
     545        self.xmin=0.0 
     546        self.xmax=0.0 
     547        self.xminView=0.0 
     548        self.xmaxView=0.0     
    525549        self.prevXtrans = self.xscales  
    526550        self.prevYtrans = self.yscales   
     
    539563        list = self.graph.returnPlottable() 
    540564        for item in list: 
    541             item.onFitRange(xminView,xmaxView) 
     565            #item.onFitRange(xminView,xmaxView) 
     566            item.onFitRange(None,None) 
    542567        self.xminView=xminView 
    543568        self.xmaxView=xmaxView 
  • guitools/plottables.py

    rddff053 r150c04a  
    437437    def onReset(self): 
    438438        self.view.onResetView() 
    439     def onFitRange(self,xmin,xmax): 
     439    def onFitRange(self,xmin=None,xmax=None): 
    440440        self.view.onFitRangeView(xmin,xmax) 
    441441    class View: 
     
    608608                self.dy=tempdy 
    609609                 
    610         def onFitRangeView(self,xmin,xmax): 
     610        def onFitRangeView(self,xmin=None,xmax=None): 
    611611            tempx=[] 
    612612            tempdx=[] 
     
    617617            if self.dy==None: 
    618618                self.dy=numpy.zeros(len(self.y)) 
    619             for i in range(len(self.x)): 
    620                 if ( self.x[i] >= xmin ) and ( self.x[i] <= xmax ): 
    621                     tempx.append(self.x[i]) 
    622                     tempdx.append(self.dx[i]) 
    623                     tempy.append(self.y[i]) 
    624                     tempdy.append(self.dy[i]) 
    625             self.x=tempx 
    626             self.y=tempy 
    627             self.dx=tempdx 
    628             self.dy=tempdy         
     619            if ( xmin != None ) and ( xmax != None ): 
     620                for i in range(len(self.x)): 
     621                    if ( self.x[i] >= xmin ) and ( self.x[i] <= xmax ): 
     622                        tempx.append(self.x[i]) 
     623                        tempdx.append(self.dx[i]) 
     624                        tempy.append(self.y[i]) 
     625                        tempdy.append(self.dy[i]) 
     626                self.x=tempx 
     627                self.y=tempy 
     628                self.dx=tempdx 
     629                self.dy=tempdy         
    629630 
    630631class Data1D(Plottable): 
Note: See TracChangeset for help on using the changeset viewer.