Changeset 202f93a in sasview
- Timestamp:
- Jul 18, 2008 1:54:23 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:
- acb1ad1
- Parents:
- 75b40ce
- Location:
- park_integration
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
r6831a99 r202f93a 48 48 if pars !={}: 49 49 self.parameters=[] 50 self.paramList=[] 50 51 if model==None: 51 52 raise ValueError, "Cannot set parameters for empty model" … … 55 56 param = Parameter(model, key, value) 56 57 self.parameters.append(param) 58 self.paramList.append(key) 57 59 58 60 #A fitArrange is already created but contains dList only at Uid -
park_integration/ParkFitting.py
rdf58d26f r202f93a 50 50 self.model = sans_model 51 51 sansp = sans_model.getParamList() 52 52 53 parkp = [SansParameter(p,sans_model) for p in sansp] 53 54 self.parameterset = park.ParameterSet(sans_model.name,pars=parkp) … … 136 137 """ 137 138 self.fitArrangeList={} 138 139 139 140 def createProblem(self): 140 141 """ … … 145 146 mylist=[] 146 147 listmodel=[] 148 147 149 for k,value in self.fitArrangeList.iteritems(): 148 150 sansmodel=value.get_model() … … 150 152 parkmodel = Model(sansmodel) 151 153 for p in parkmodel.parameterset: 152 if p.isfixed(): 154 #self.param_list.append(p._getname()) 155 if p.isfixed() and p._getname()in self.paramList: 153 156 p.set([-numpy.inf,numpy.inf]) 154 157 … … 180 183 """ 181 184 182 183 185 self.createProblem() 184 186 pars=self.problem.fit_parameters() -
park_integration/test/constrainttestpark.py
r4dd63eb r202f93a 52 52 #self.assert_(chisqr2/len(data1.x) < 2) 53 53 #self.assert_(chisqr2/len(data2.x) < 2) 54 def testmodel1data1param1(self): 55 """ test fitting for two set of data and one model with 2 constraint""" 56 from sans.fit.Loader import Load 57 load= Load() 58 #Load the first set of data 59 load.set_filename("testdata1.txt") 60 load.set_values() 61 data1 = Data1D(x=[], y=[],dx=None, dy=None) 62 load.load_data(data1) 54 63 64 #Load the second set of data 65 load.set_filename("testdata2.txt") 66 load.set_values() 67 data2 = Data1D(x=[], y=[],dx=None, dy=None) 68 load.load_data(data2) 69 70 #Importing the Fit module 71 from sans.fit.Fitting import Fit 72 fitter= Fit('park') 73 # Receives the type of model for the fitting 74 from sans.guitools.LineModel import LineModel 75 model1 = LineModel() 76 77 78 #Do the fit 79 80 fitter.set_model(model1,"M1",1, {'A':1}) 81 fitter.set_data(data1,1) 82 83 84 85 chisqr2, out2, cov2 = fitter.fit() 86 print "chisqr2",chisqr2 87 print "out2", out2 88 print " cov2", cov2 89 print chisqr2/len(data1.x) 90 91 self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2) 92 self.assert_(math.fabs(out2[0]-4.0)/math.sqrt(cov2[0][0]) < 2) 93 #self.assert_(chisqr2/len(data1.x) < 2) 94 #self.assert_(chisqr2/len(data2.x) < 2) 95
Note: See TracChangeset
for help on using the changeset viewer.