- Timestamp:
- Apr 3, 2008 12:43:04 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:
- d490a02
- Parents:
- f0c09d5
- Location:
- guitools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
r061775ff rf63f5ff 82 82 if len(list.keys())>0: 83 83 first_item = list.keys()[0] 84 print first_item, list[first_item].__class__.__name__84 #print first_item, list[first_item].__class__.__name__ 85 85 dlg = LinearFit( None, first_item, self.onFitDisplay, -1, 'Fitting') 86 86 dlg.ShowModal() … … 412 412 """ 413 413 if dx >=x: 414 return 0.9*x414 return math.fabs(0.9*x) 415 415 if dx==None: 416 416 return 0 417 return dx417 return math.fabs(dx) 418 418 def errFuncToX2(self,x,dx=None): 419 419 """ … … 426 426 if err >= x: 427 427 err = 0.9*x 428 return err428 return math.fabs(err) 429 429 else: 430 430 return 0.0 … … 445 445 err = 0.9*x 446 446 447 return err447 return math.fabs(err) 448 448 449 449 def errFuncToLogX(self,x,dx=None): … … 464 464 err = 0.9*x 465 465 466 return err466 return math.fabs(err) 467 467 468 468 def errFuncfromLogXY(self,x,dx=None): … … 485 485 self.graph.render(self) 486 486 self.subplot.figure.canvas.draw_idle() 487 487 488 488 489 489 class NoRepaintCanvas(FigureCanvasWxAgg): -
guitools/fitDialog.py
r061775ff rf63f5ff 26 26 vbox.Add(panel, 1, wx.EXPAND | wx.ALL) 27 27 28 self.tcA = wx.TextCtrl(panel, -1,s tyle=wx.SIMPLE_BORDER)29 self.tcErrA = wx.TextCtrl(panel, -1,s tyle=wx.SIMPLE_BORDER)30 self.tcB = wx.TextCtrl(panel, -1,s tyle=wx.SIMPLE_BORDER)31 self.tcErrB = wx.TextCtrl(panel, -1,s tyle=wx.SIMPLE_BORDER)32 self.tcChi = wx.TextCtrl(panel, -1,s tyle=wx.SIMPLE_BORDER)28 self.tcA = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER) 29 self.tcErrA = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER) 30 self.tcB = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER) 31 self.tcErrB = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER) 32 self.tcChi = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER) 33 33 self.tcXmin = wx.TextCtrl(panel,-1,style=wx.SIMPLE_BORDER) 34 34 self.tcXmax = wx.TextCtrl(panel,-1,style=wx.SIMPLE_BORDER) … … 93 93 print "we are on fit" 94 94 temp =[] 95 #tempdx =[]95 tempdx =[] 96 96 tempdy =[] 97 97 xmin = self._checkVal(self.tcXmin.GetValue()) 98 98 xmax = self._checkVal(self.tcXmax.GetValue()) 99 x= self.plottable.x 100 if x: 99 #x= self.plottable.view.x 100 x=self.plottable.returnXvalueOfView() 101 print "x value :" ,x 102 if x != []: 101 103 if xmin !=None and xmax != None: 102 104 for j in range(len(x)): … … 113 115 for y_i in temp: 114 116 tempdy.append(math.sqrt(y_i)) 115 self.tcXmin.SetValue(str(min( self.plottable.x)))116 self.tcXmax.SetValue(str(max( self.plottable.x)))117 self.tcXmin.SetValue(str(min(x))) 118 self.tcXmax.SetValue(str(max(x))) 117 119 xmin = self._checkVal(self.tcXmin.GetValue()) 118 120 xmax = self._checkVal(self.tcXmax.GetValue()) … … 132 134 cstB = fittings.Parameter(self.model, 'B', default_B) 133 135 chisqr, out, cov = fittings.sansfit(self.model, 134 [cstA, cstB], self.plottable. x,135 self.plottable. y, self.plottable.dy,xmin,xmax)136 [cstA, cstB], self.plottable.view.x, 137 self.plottable.view.y, self.plottable.view.dy,xmin,xmax) 136 138 # Create new data plottable with result 137 139 138 140 self.file_data1.y = [] 141 #for x_i in self.file_data1.x: 139 142 for x_i in self.file_data1.x: 140 143 self.file_data1.y.append(self.model.run(x_i)) 141 144 142 145 self.push_data(self.file_data1) 143 144 self._onsetValues(str(out[0]),str(out[1]),\ 145 str(math.sqrt(cov[0][0])),str(math.sqrt(cov[1][1])),str(chisqr)) 146 if cov ==None: 147 errA =str(0.0) 148 errB =str(0.0) 149 else: 150 errA= str(math.sqrt(cov[0][0])) 151 errB= str(math.sqrt(cov[1][1])) 152 if out==None: 153 cstA=str(0.0) 154 cstB=str(0.0) 155 else: 156 cstA=str(out[0]) 157 cstB=str(out[1]) 158 self._onsetValues(cstA, cstB, errA,errB,str(chisqr)) 146 159 147 160 def _onsetValues(self,cstA,cstB,errA,errB,Chi): … … 149 162 self.tcA.SetValue(cstA) 150 163 self.tcB.SetValue(cstB) 151 self.tcErrA.SetValue( cstB)152 self.tcErrB.SetValue( cstA)164 self.tcErrA.SetValue(errA) 165 self.tcErrB.SetValue(errB) 153 166 self.tcChi.SetValue(Chi) 154 167 -
guitools/plottables.py
r061775ff rf63f5ff 378 378 """ 379 379 self.view.transform_y(func, errfunc, self.y, self.dy) 380 380 381 def returnXvalueOfView(self): 382 return self.view.returnXview() 383 384 381 385 class View: 382 386 """ … … 443 447 else: 444 448 self.dy[i] = errfunc(y[i]) 449 450 def returnXview(self): 451 return self.x 445 452 446 453 class Data1D(Plottable):
Note: See TracChangeset
for help on using the changeset viewer.