Changeset ad8bcd6 in sasview
- Timestamp:
- Jun 13, 2008 2:12:48 PM (16 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:
- fc2b91a
- Parents:
- b659551
- Location:
- guitools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
rac9c465 rad8bcd6 13 13 from pylab import gca, gcf 14 14 from plottables import Theory1D 15 16 #from matplotlib.backend_bases import MouseEvent17 #from plottables import Data1D18 15 #TODO: make the plottables interactive 19 16 … … 92 89 lo=loprev 93 90 hi=hiprev 94 #print "Not possible to scale"95 96 91 else: 97 92 lo,hi = math.pow(10.,lo),math.pow(10.,hi) 98 #assert lo >0,"lo = %g"%lo99 #print "possible to scale"100 101 #print "these are low and high",lo,hi102 103 93 return (lo,hi) 104 94 … … 158 148 self.mousemotion=False 159 149 160 #self.canvas.Bind(wx.EVT_MOUSE_EVENTS,self.onTest)161 150 self.axes = [self.subplot] 162 151 # new data for the fit 163 152 self.fit_result = Theory1D(x=[], y=[], dy=None) 164 153 #self.fit_result = Data1D(x=[], y=[],dx=None, dy=None) … … 174 163 self.ErrBvalue=None 175 164 self.Chivalue=None 165 166 # Dragging info 176 167 self.begDrag=False 177 #self.begDragI=False178 168 self.xInit=None 179 169 self.yInit=None 180 170 self.xFinal=None 181 171 self.yFinal=None 182 172 173 # Default locations 174 self._default_save_location = os.getcwd() 175 176 183 177 def onLeftDown(self,event): 184 178 """ left button down and ready to drag""" 185 179 self.leftdown=True 186 180 ax = event.inaxes 187 if ax != None:181 if ax != None: 188 182 self.xInit,self.yInit=event.xdata,event.ydata 189 183 … … 208 202 self.xFinal,self.yFinal=event.xdata,event.ydata 209 203 204 # Check whether this is the first point 205 if self.xInit==None: 206 self.xInit = self.xFinal 207 self.yInit = self.yFinal 208 210 209 xdelta = self.xFinal -self.xInit 211 210 ydelta = self.yFinal -self.yInit … … 450 449 #print "Save image not implemented" 451 450 path = None 452 dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.png", wx.SAVE)451 dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, "", "*.png", wx.SAVE) 453 452 if dlg.ShowModal() == wx.ID_OK: 454 453 path = dlg.GetPath() 455 mypath = os.path.basename(path) 456 print path 454 self._default_save_location = os.path.dirname(path) 457 455 dlg.Destroy() 458 456 if not path == None: … … 654 652 655 653 if (self.xLabel=="log10(x)" ): 656 item.transformX(transform.toX ,transform.errToX)654 item.transformX(transform.toX_pos,transform.errToX_pos) 657 655 self.set_xscale("log") 658 656 name, units = item.get_xaxis() … … 664 662 self.set_yscale("linear") 665 663 name, units = item.get_yaxis() 666 self.graph.yaxis(" log\ \ %s" % name, "%s" % units)664 self.graph.yaxis("\log\ \ %s" % name, "%s" % units) 667 665 668 666 … … 675 673 676 674 if ( self.yLabel=="log10(y)" ): 677 item.transformY(transform.toX ,transform.errToX)675 item.transformY(transform.toX_pos,transform.errToX_pos) 678 676 self.set_yscale("log") 679 677 name, units = item.get_yaxis() … … 708 706 yname, yunits = item.get_yaxis() 709 707 xname, xunits = item.get_xaxis() 710 self.graph.yaxis(" log\ (%s \ \ %s)" % (yname,xname), "%s%s" % (yunits,xunits))708 self.graph.yaxis("\log\ (%s \ \ %s)" % (yname,xname), "%s%s" % (yunits,xunits)) 711 709 712 710 … … 717 715 xname, xunits = item.get_xaxis() 718 716 xunits = convertUnit(2,xunits) 719 self.graph.yaxis(" Log (%s \ \ %s^{2})" % (yname,xname), "%s%s" % (yunits,xunits))717 self.graph.yaxis("\log (%s \ \ %s^{2})" % (yname,xname), "%s%s" % (yunits,xunits)) 720 718 721 719 … … 726 724 xname, xunits = item.get_xaxis() 727 725 xunits = convertUnit(4,xunits) 728 self.graph.yaxis(" Log (%s \ \ %s^{4})" % (yname,xname), "%s%s" % (yunits,xunits))726 self.graph.yaxis("\log (%s \ \ %s^{4})" % (yname,xname), "%s%s" % (yunits,xunits)) 729 727 730 728 if ( self.viewModel == "Guinier lny vs x^(2)"): … … 740 738 self.set_yscale("linear") 741 739 name, units = item.get_yaxis() 742 self.graph.yaxis(" $Log %s$" % name, "%s" % units)740 self.graph.yaxis("\log\ \ %s" % name, "%s" % units) 743 741 744 742 -
guitools/fitDialog.py
r052a66bc rad8bcd6 285 285 286 286 #Find the fitting parameters 287 # Always use the same defaults, so that fit history doesn't play a role! 288 self.cstA = fittings.Parameter(self.model, 'A', self.default_A) 289 self.cstB = fittings.Parameter(self.model, 'B', self.default_B) 287 290 288 291 if (self.xLabel.lower() == "log10(x)"): -
guitools/transform.py
r05da1f89 rad8bcd6 8 8 """ 9 9 return x 10 11 def toX_pos(x,y=None): 12 """ 13 This function is used to load value on Plottable.View 14 @param x: Float value 15 @return x, 16 """ 17 if not x>0: 18 raise ValueError, "Transformation only accepts positive values." 19 else: 20 return x 10 21 11 22 def toX2(x,y=None): … … 35 46 """ 36 47 if not x > 0: 37 raise ValueError, "Log( X)of a negative value "48 raise ValueError, "Log(x)of a negative value " 38 49 else: 39 50 return math.log(x) … … 86 97 if dx==None: 87 98 dx=0 99 return dx 100 101 def errToX_pos(x,y=None,dx=None,dy=None): 102 """ 103 calculate error of x**2 104 @param x: float value 105 @param dx: float value 106 """ 107 if dx==None: 108 dx=0 109 110 # Check that the point on the graph is positive 111 # within errors 112 if not x-dx > 0: 113 raise ValueError, "Transformation does not accept point that are consistent with zero." 114 88 115 return dx 89 116 … … 124 151 if dx==None: 125 152 dx = 0 153 154 # Check that the point on the graph is positive 155 # within errors 156 if not x-dx > 0: 157 raise ValueError, "Transformation does not accept point that are consistent with zero." 158 126 159 if x!=0: 127 160 dx = dx/(x*math.log(10)) … … 139 172 if dx==None: 140 173 dx = 0 174 175 # Check that the point on the graph is positive 176 # within errors 177 if not x-dx > 0: 178 raise ValueError, "Transformation does not accept point that are consistent with zero." 179 141 180 if x!=0: 142 181 dx = dx/x … … 160 199 calculate error of Log(xy) 161 200 """ 201 # Check that the point on the graph is positive 202 # within errors 203 if (not x-dx > 0) or (not y-dy > 0): 204 raise ValueError, "Transformation does not accept point that are consistent with zero." 205 162 206 if (x!=0) and (y!=0): 163 207 if dx == None: … … 175 219 calculate error of Log(yx**2) 176 220 """ 221 # Check that the point on the graph is positive 222 # within errors 223 if (not x-dx > 0) or (not y-dy > 0): 224 raise ValueError, "Transformation does not accept point that are consistent with zero." 225 177 226 if (x > 0) and (y > 0): 178 227 if (dx == None): … … 217 266 @param x: float value 218 267 """ 268 # Check that the point on the graph is positive 269 # within errors 270 if (not x-dx > 0) or (not y-dy > 0): 271 raise ValueError, "Transformation does not accept point that are consistent with zero." 272 219 273 if dx==None: 220 274 dx=0
Note: See TracChangeset
for help on using the changeset viewer.