Changeset 916a15f in sasview for park_integration
- Timestamp:
- Sep 22, 2008 8:16:39 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:
- 55fd102
- Parents:
- 70975f3
- Location:
- park_integration
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/ParkFitting.py
rfadea71 r916a15f 41 41 the user should make sure to call set_param himself. 42 42 """ 43 def __init__(self ,data=[]):43 def __init__(self): 44 44 """ 45 45 Creates a dictionary (self.fitArrangeList={})of FitArrange elements … … 61 61 parkmodel = value.get_model() 62 62 for p in parkmodel.parameterset: 63 if p.isfixed() and p._getname()in self.paramList: 64 p.set([-numpy.inf,numpy.inf]) 65 i+=1 63 if p._getname()in self.paramList and not p.iscomputed(): 64 p.status = 'fitted' # make it a fitted parameter 65 #iscomputed paramter with string inside 66 67 i+=1 66 68 Ldata=value.get_data() 67 69 parkdata=self._concatenateData(Ldata) … … 89 91 @return result.cov: Covariance matrix 90 92 """ 91 92 93 self.createAssembly() 93 pars=self.problem.fit_parameters() 94 self.problem.eval() 94 95 95 localfit = FitSimplex() 96 96 localfit.ftol = 1e-8 97 # fitmc(fitness,localfit,n,handler): 98 #Run a monte carlo fit. 99 #This procedure maps a local optimizer across a set of n initial points. 100 #The initial parameter value defined by the fitness parameters defines 101 #one initial point. The remainder are randomly generated within the 102 #bounds of the problem. 103 #localfit is the local optimizer to use. It should be a bounded 104 #optimizer following the `park.fitmc.LocalFit` interface. 105 #handler accepts updates to the current best set of fit parameters. 106 # See `park.fitresult.FitHandler` for details. 97 107 fitter = FitMC(localfit=localfit) 98 list=self.problem[0]._parameterset()99 108 #result = fit.fit(self.problem, 100 109 # fitter=fitter, … … 103 112 fitter=fitter, 104 113 handler= fitresult.ConsoleUpdate(improvement_delta=0.1)) 105 106 107 114 if result !=None: 108 115 return result -
park_integration/test/test_fit_cylinder.py
rca6d914 r916a15f 31 31 fitter.set_data(data,1) 32 32 model.model.setParam('scale',10) 33 fitter.set_model(model, "M1",1,pars1)33 fitter.set_model(model,1,pars1) 34 34 result1 = fitter.fit() 35 35 print "test scipy result:",result1.stderr,result1.pvec,result1.fitness -
park_integration/test/test_fit_line.py
rca6d914 r916a15f 136 136 model11 = LineModel() 137 137 model11.name= "line" 138 model11.setParam('A',4) 139 model11.setParam('B',3) 138 140 model22 = Constant() 139 141 model22.name= "cst" … … 179 181 model1 = LineModel() 180 182 model1.name= "M1" 181 183 182 184 data1 = Data(sans_data=data11 ) 183 185 data2 = Data(sans_data=data22 ) … … 192 194 result1 = fitter.fit() 193 195 self.assert_(result1) 194 196 195 197 self.assertTrue( ( math.fabs(result1.pvec[0]-4)/3 == result1.stderr[0] ) or 196 198 ( math.fabs(result1.pvec[0]-4)/3 < result1.stderr[0]) )
Note: See TracChangeset
for help on using the changeset viewer.