Changeset f63f5ff in sasview for guitools/fitDialog.py
- Timestamp:
- Apr 3, 2008 10:43:04 AM (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:
- d490a02
- Parents:
- f0c09d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.