- Timestamp:
- Apr 16, 2008 10:22:24 AM (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:
- 35891ce
- Parents:
- 3aa7074
- Location:
- guitools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
rdfca3de r8e44d51 389 389 self.graph.yaxis("%s%s" % (yname,xname), "%s^{-1}%s^{-1}" % (yunits,xunits)) 390 390 391 if ( self.yscales =="ln(y*x^(2) "):392 item.transform_y( transform.toYX2 ,transform. ToYX2 )391 if ( self.yscales =="ln(y*x^(2))"): 392 item.transform_y( transform.toYX2 ,transform.errToLogYX2 ) 393 393 self.set_yscale("linear") 394 394 yname, yunits = item.get_yaxis() -
guitools/fitDialog.py
r3aa7074 r8e44d51 43 43 self.btClose =wx.Button(panel, wx.ID_CANCEL,'Close',size=(90, 30) ) 44 44 self.static_line_1 = wx.StaticLine(panel, -1) 45 45 46 ix = 0 46 47 iy = 1 47 48 48 sizer.Add(wx.StaticText(panel, -1, 'y = Ax +B'),(iy, ix),(1,1),\ 49 49 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 50 51 50 iy+=1 52 51 sizer.Add(wx.StaticText(panel, -1, 'Param A'),(iy, ix),\ … … 58 57 ix += 1 59 58 sizer.Add(self.tcErrA, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 60 61 59 iy += 1 62 60 ix = 0 … … 108 106 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 109 107 110 111 108 panel.SetSizer(sizer) 112 109 self.SetSizer(vbox) 113 110 self.Centre() 111 114 112 # Receives the type of model for the fitting 115 113 from LineModel import LineModel 116 114 self.model = LineModel() 117 118 115 119 116 #Display the fittings values … … 139 136 self.PXmin.Disable() 140 137 self.PXmax.Disable() 141 142 138 143 139 # new data for the fit 144 140 self.file_data1 = Theory1D(x=[], y=[], dy=None) … … 158 154 #Check if the field of Fit Dialog contain values and use the x max and min of the user 159 155 xmin,xmax = self._checkVal(self.FXmin.GetValue(),self.FXmax.GetValue()) 160 161 156 #store the values of View in x,y, dx,dy 162 157 x,y,dx,dy=self.plottable.returnValuesOfView() … … 167 162 # makes transformation for y as a line to fit 168 163 if x != []: 169 170 164 xminView=self.floatTransform(xmin) 171 165 xmaxView=self.floatTransform(xmax) … … 190 184 191 185 #Find the fitting parameters 192 print "X", tempx193 print "Y", tempy194 186 chisqr, out, cov = fittings.sansfit(self.model, 195 187 [self.cstA, self.cstB],tempx, tempy,tempdy,xminView,xmaxView) … … 211 203 self.model.setParam('A', float(cstA)) 212 204 self.model.setParam('B', float(cstB)) 213 print "this is constant A:",float(cstA)205 214 206 tempx = [] 215 207 tempy = [] … … 241 233 else: 242 234 tempy.append(y_model) 243 244 245 print "this max",xmax 246 print "this view xmax", xmaxView 235 247 236 # Create new data plottable with result 248 237 self.file_data1.x =[] … … 252 241 self.file_data1.dx=None 253 242 self.file_data1.dy=None 254 print "this is the min of data1",min(self.file_data1.x )255 print "this is the max of data1",max(self.file_data1.x )256 243 #Load the view with the new values 257 244 self.file_data1.reset_view() -
guitools/plottables.py
r831149e r8e44d51 40 40 41 41 # Support for ancient python versions 42 import copy 43 import numpy 44 42 45 if 'any' not in dir(__builtins__): 43 46 def any(L): … … 434 437 @param errfunc: function to apply to errors 435 438 """ 436 import copy 437 import numpy 439 438 440 439 441 # Sanity check … … 483 485 @param errfunc: function to apply to errors dy 484 486 """ 485 import copy486 import numpy487 487 # Sanity check 488 488 has_x = False … … 589 589 def changed(self): 590 590 return False 591 591 592 @classmethod 592 593 def labels(cls, collection): … … 598 599 return map 599 600 600 601 601 602 602 class Fit1D(Plottable): 603 603 """Fit plottable: composed of a data line plus a theory line. This -
guitools/transform.py
r831149e r8e44d51 83 83 else: 84 84 return math.log(x*y) 85 def errToLogYX4(x,y=None,dx=None,dy=None): 86 """ 87 error for ln(y*x^(4)) 88 @param x: float value 89 """ 90 if dx==None: 91 dx=0 92 if dy==None: 93 dy=0 94 err =math.sqrt((4*dx/x)**2 +(dy/y)**2) 95 if err >= math.fabs(x): 96 err =0.9*x 97 return err 85 98 86 def fromLogXY(self,x): 99 87 """ … … 204 192 if (dy == None): 205 193 dy = 0 206 err = 4*(dx**2)/(x**2) + (dy**2)/(y**2)194 err = (2*dx/x)**2 + (dy/y)**2 207 195 if math.fabs(err) >= math.fabs(x): 208 196 err =0.9*x … … 241 229 242 230 return math.fabs(err) 231 def errToLogYX4(x,y=None,dx=None,dy=None): 232 """ 233 error for ln(y*x^(4)) 234 @param x: float value 235 """ 236 if dx==None: 237 dx=0 238 if dy==None: 239 dy=0 240 err =math.sqrt((4*dx/x)**2 +(dy/y)**2) 241 if err >= math.fabs(x): 242 err =0.9*x 243 return err 243 244 244 245
Note: See TracChangeset
for help on using the changeset viewer.