Changeset 73bbe35 in sasview
- Timestamp:
- May 21, 2008 5:53:34 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:
- e94d1d3
- Parents:
- 0954398
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/test/FittingModule.py
r0954398 r73bbe35 51 51 #the list of all data to fit 52 52 self.data = data 53 # dictionaryof models parameters54 self.parameters= {}53 #list of models parameters 54 self.parameters=[] 55 55 self.contraint =None 56 56 self.residuals=[] 57 58 def fit_engine(self): 57 self.fitType =None 58 59 def fit_engine(self,word): 59 60 """ 60 61 Check the contraint value and specify what kind of fit to use 61 62 """ 63 self.fitType = word 62 64 return True 63 65 … … 77 79 model =fitproblem.get_model() 78 80 listdata= fitproblem.get_data() 79 81 self.set_param(model, pars) 82 print "this is self.parameters",self.parameters 80 83 for data in listdata: 81 84 for i in range(len(data.x)): … … 92 95 if qmax==None: 93 96 qmax= max(xtemp) 94 chisqr, out, cov = fitHelper(model, pars, xtemp,ytemp, dytemp ,qmin,qmax)97 chisqr, out, cov = fitHelper(model,self.parameters, xtemp,ytemp, dytemp ,qmin,qmax) 95 98 return chisqr, out, cov 96 99 … … 116 119 return self.data 117 120 121 def set_param(self,model, pars): 122 """ Recieve a dictionary of parameter and save it """ 123 self.parameters=[] 124 #for key ,value in pars: 125 for key, value in pars.iteritems(): 126 print "this is the key",key 127 print "this is the value",value 128 param = Parameter(model, key, value) 129 self.parameters.append(param) 130 118 131 def add_contraint(self, contraint): 119 132 """ User specify contraint to fit """ … … 215 228 Fit.set_model(model,1 ) 216 229 Fit.set_data(data1,1) 217 default_A = model.getParam('A') 218 default_B = model.getParam('B') 219 cstA = Parameter(model, 'A', default_A) 220 cstB = Parameter(model, 'B', default_B) 221 222 chisqr, out, cov=Fit.fit([cstA,cstB],None,None) 230 #default_A = model.getParam('A') 231 #default_B = model.getParam('B') 232 #cstA = Parameter(model, 'A', default_A) 233 #cstB = Parameter(model, 'B', default_B) 234 235 #chisqr, out, cov=Fit.fit([cstA,cstB],None,None) 236 chisqr, out, cov=Fit.fit({'A':2,'B':1},None,None) 223 237 print"fit only one data",chisqr, out, cov 224 238 … … 240 254 load.load_data(data3) 241 255 Fit.set_data(data3,2) 242 chisqr, out, cov=Fit.fit( [cstA,cstB],None,None)256 chisqr, out, cov=Fit.fit({'A':2,'B':1},None,None) 243 257 print"fit two data",chisqr, out, cov 244 258
Note: See TracChangeset
for help on using the changeset viewer.