Changeset 5789654 in sasview for guitools/fitDialog.py
- Timestamp:
- Apr 7, 2008 4:31:09 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:
- 8742751
- Parents:
- fcaada5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/fitDialog.py
r1bde57a r5789654 89 89 # new data for the fit 90 90 self.file_data1 = Theory1D(x=[], y=[], dy=None) 91 self.file_data1.name = " y= exp(A + bx**2)"91 self.file_data1.name = "Fit" 92 92 93 93 def _onFit(self ,event): … … 95 95 print "we are on fit" 96 96 temp =[] 97 tempdx =[]98 tempdy =[]99 97 xmin = self._checkVal(self.tcXmin.GetValue()) 100 98 xmax = self._checkVal(self.tcXmax.GetValue()) 101 #x= self.plottable.view.x 102 x=self.plottable.returnXvalueOfView() 103 print "x value :" ,x 99 100 #store the values of View in x,y, dx,dy 101 x,y,dx,dy=self.plottable.returnValuesOfView() 102 104 103 if x != []: 105 104 if xmin !=None and xmax != None: … … 107 106 if x[j]>xmin and x[j]<xmax: 108 107 temp.append(self.model.run(x[j])) 109 #tempdx.append(math.sqrt(x[j]))108 110 109 for y_i in temp: 111 110 tempdy.append(math.sqrt(y_i)) … … 114 113 for x_i in x: 115 114 temp.append(self.model.run(x_i)) 116 tempdx.append(math.sqrt(x_i)) 117 for y_i in temp: 118 tempdy.append(math.sqrt(y_i)) 115 119 116 self.tcXmin.SetValue(str(min(x))) 120 117 self.tcXmax.SetValue(str(max(x))) … … 124 121 self.file_data1.x =x 125 122 self.file_data1.y =temp 126 #self.file_data1.dx=tempdx123 127 124 self.file_data1.dx=None 128 #self.file_data1.dy=tempdy129 125 self.file_data1.dy=None 130 126 self.file_data1.reset_view() 131 127 132 128 # Display the fittings values … … 136 132 cstB = fittings.Parameter(self.model, 'B', default_B) 137 133 chisqr, out, cov = fittings.sansfit(self.model, 138 [cstA, cstB], self.plottable.view.x, 139 self.plottable.view.y, self.plottable.view.dy,xmin,xmax) 140 # Create new data plottable with result 134 [cstA, cstB],x, y,dy,min(x),max(x)) 141 135 142 self.file_data1.y = [] 143 #for x_i in self.file_data1.x: 144 for x_i in self.file_data1.x: 145 self.file_data1.y.append(self.model.run(x_i)) 146 147 self.push_data(self.file_data1) 136 137 #Check that cov and out are iterable before displaying them 148 138 if cov ==None: 149 139 errA =str(0.0) … … 158 148 cstA=str(out[0]) 159 149 cstB=str(out[1]) 150 151 self.model.setParam('A', float(cstA)) 152 self.model.setParam('B', float(cstB)) 153 # Create new data plottable with result 154 self.file_data1.y = [] 155 156 for x_i in x: 157 self.file_data1.y.append(self.model.run(x_i)) 158 #Send the data to display to the PlotPanel 159 self.file_data1.reset_view() 160 self.push_data(self.file_data1) 161 # Display the fitting value on the Fit Dialog 160 162 self._onsetValues(cstA, cstB, errA,errB,str(chisqr)) 161 163
Note: See TracChangeset
for help on using the changeset viewer.