Changeset 150c04a in sasview
- Timestamp:
- May 2, 2008 5:16:06 PM (17 years ago)
- 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
- Location:
- guitools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
rddff053 r150c04a 35 35 # Convert values into the correct scale for a linear transformation 36 36 # TODO: use proper scale transformers 37 loprev = lo 38 hiprev = hi 39 ptprev = pt 37 40 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) 39 46 if pt is not None: pt = math.log10(pt) 40 47 41 48 # Compute delta from axis range * %, or 1-% if persent is negative 42 49 if step > 0: … … 54 61 # Convert transformed values back to the original scale 55 62 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 59 79 return (lo,hi) 60 80 … … 137 157 if insidex: 138 158 xdata,_ = ax.transAxes.inverse_xy_tup((x,y)) 139 #print "xaxis",x,"->",xdata159 print "xaxis",x,"->",xdata 140 160 insidey,_ = ax.yaxis.contains(event) 141 161 if insidey: 142 162 _,ydata = ax.transAxes.inverse_xy_tup((x,y)) 143 #print "yaxis",y,"->",ydata163 print "yaxis",y,"->",ydata 144 164 if xdata is not None: 145 165 lo,hi = ax.get_xlim() … … 150 170 lo,hi = _rescale(lo,hi,step,bal=ydata,scale=ax.get_yscale()) 151 171 ax.set_ylim((lo,hi)) 152 172 153 173 self.canvas.draw_idle() 154 174 … … 522 542 self.graph.yaxis("$Log %s$" % name, "%s^{-1}" % units) 523 543 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 525 549 self.prevXtrans = self.xscales 526 550 self.prevYtrans = self.yscales … … 539 563 list = self.graph.returnPlottable() 540 564 for item in list: 541 item.onFitRange(xminView,xmaxView) 565 #item.onFitRange(xminView,xmaxView) 566 item.onFitRange(None,None) 542 567 self.xminView=xminView 543 568 self.xmaxView=xmaxView -
guitools/plottables.py
rddff053 r150c04a 437 437 def onReset(self): 438 438 self.view.onResetView() 439 def onFitRange(self,xmin ,xmax):439 def onFitRange(self,xmin=None,xmax=None): 440 440 self.view.onFitRangeView(xmin,xmax) 441 441 class View: … … 608 608 self.dy=tempdy 609 609 610 def onFitRangeView(self,xmin ,xmax):610 def onFitRangeView(self,xmin=None,xmax=None): 611 611 tempx=[] 612 612 tempdx=[] … … 617 617 if self.dy==None: 618 618 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 629 630 630 631 class Data1D(Plottable):
Note: See TracChangeset
for help on using the changeset viewer.