Changeset 985c88b in sasview
- Timestamp:
- Aug 12, 2008 4:45:44 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:
- 4245594
- Parents:
- f44dbc7
- Location:
- park_integration
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
rf44dbc7 r985c88b 62 62 self.parameters.append(param) 63 63 64 self.paramList.append( key)64 self.paramList.append(param_name) 65 65 print "AbstractFitEngine: self.paramList2", self.paramList 66 66 #A fitArrange is already created but contains dList only at Uid -
park_integration/test/constrainttestpark.py
r202f93a r985c88b 34 34 35 35 #Do the fit 36 model1.setParam( 'A', 1) 37 model1.setParam( 'B', 2) 38 fitter.set_model(model1,"M1",1, ['A','B']) 39 fitter.set_data(data1,1) 36 40 37 fitter.set_model(model1,"M1",1, {'A':1,'B':2}) 38 fitter.set_data(data1,1) 39 40 fitter.set_model(model2,"M2",2, {'A':'M1.A','B':'M1.B'}) 41 model2.setParam( 'A', 'M1.A') 42 model2.setParam( 'B','M1.B') 43 fitter.set_model(model2,"M2",2, ['A','B']) 41 44 fitter.set_data(data2,2) 42 45 43 46 44 chisqr2, out2, cov2 = fitter.fit()47 chisqr2, out2, cov2,result= fitter.fit() 45 48 print "chisqr2",chisqr2 46 49 print "out2", out2 … … 77 80 78 81 #Do the fit 79 80 fitter.set_model(model1,"M1",1, {'A':1})82 model1.setParam( 'A', 1) 83 fitter.set_model(model1,"M1",1, ['A']) 81 84 fitter.set_data(data1,1) 82 85 83 86 84 87 85 chisqr2, out2, cov2 = fitter.fit()88 chisqr2, out2, cov2,result = fitter.fit() 86 89 print "chisqr2",chisqr2 87 90 print "out2", out2 -
park_integration/test/test_fitting_panel.py
r30c6721 r985c88b 14 14 class testFitModule(unittest.TestCase): 15 15 def test0(self): 16 """ test fitting for two set of data and one model Bconstraint"""16 """ test fitting for two set of data and 2 models no constraint""" 17 17 from sans.fit.Loader import Load 18 18 load= Load() … … 38 38 39 39 #Do the fit 40 model1.setParam( 'A', 1) 41 model1.setParam( 'B', 2) 42 fitter.set_model(model1,"M1",1, ['A','B']) 43 fitter.set_data(data1,1) 40 44 41 fitter.set_model(model1,"M1",1, {'A':1,'B':1}) 42 fitter.set_data(data1,1) 43 44 fitter.set_model(model2,"M2",2, {'A':1,'B':1}) 45 model2.setParam( 'A', 1) 46 model2.setParam( 'B', 1) 47 fitter.set_model(model2,"M2",2, ['A','B']) 45 48 fitter.set_data(data2,2) 46 49 47 50 48 51 chisqr1, out1, cov1,result= fitter.fit() 49 self.assert_(chisqr1)50 52 print "chisqr1",chisqr1 51 53 print "out1", out1 52 54 print " cov1", cov1 55 self.assert_(chisqr1) 53 56 54 57 def test01(self): 55 """ test fitting for two set of data and one model B constraint"""58 """ test fitting for two set of data and 2 models and 2 constraints set on on model""" 56 59 from sans.fit.Loader import Load 57 60 load= Load() … … 77 80 78 81 #Do the fit 82 model1.setParam( 'A', 1) 83 model1.setParam( 'B', 1) 84 fitter.set_model(model1,"M1",1, ['A','B']) 85 fitter.set_data(data1,1) 79 86 80 fitter.set_model(model1,"M1",1, {'A':1,'B':1}) 81 fitter.set_data(data1,1) 82 83 fitter.set_model(model2,"M2",2, {'A':'M1.A','B':'M1.B'}) 87 model2.setParam( 'A','M1.A') 88 model2.setParam( 'B', 'M1.B') 89 fitter.set_model(model2,"M2",2, ['A','B']) 84 90 fitter.set_data(data2,2) 85 91 … … 94 100 95 101 def test1(self): 96 """ test fitting for two set of data and one model 1 constraint"""102 """ test fitting for two set of data 2 model on constraint set on 1 model""" 97 103 from sans.fit.Loader import Load 98 104 load= Load() … … 118 124 119 125 #Do the fit 126 model1.setParam( 'A',1) 127 model1.setParam( 'B',1) 128 fitter.set_model(model1,"M1",1, ['A','B']) 129 fitter.set_data(data1,1) 120 130 121 fitter.set_model(model1,"M1",1, {'A':1,'B':1}) 122 fitter.set_data(data1,1) 123 124 fitter.set_model(model2,"M2",2, {'A':'M1.A','B':1}) 131 model2.setParam( 'A','M1.A') 132 model2.setParam( 'B', 1) 133 fitter.set_model(model2,"M2",2, ['A','B']) 125 134 fitter.set_data(data2,2) 126 135 … … 134 143 135 144 def test2(self): 136 """ test fitting for two set of data and one model no constraint"""145 """ test fitting for two data 2 model not equal nombre of parameters fit""" 137 146 from sans.fit.Loader import Load 138 147 load= Load() … … 158 167 159 168 #Do the fit 169 model1.setParam( 'A',1) 170 model1.setParam( 'B',1) 171 fitter.set_model(model1,"M1",1, ['A','B']) 172 fitter.set_data(data1,1) 160 173 161 fitter.set_model(model1,"M1",1, {'A':1,'B':1}) 162 fitter.set_data(data1,1) 174 model2.setParam( 'A',1) 163 175 164 fitter.set_model(model2,"M2",2, {'A':1})176 fitter.set_model(model2,"M2",2, ['A']) 165 177 fitter.set_data(data2,2) 166 178 … … 172 184 self.assert_(chisqr1) 173 185 174 fitter= Fit('park')175 # Receives the type of model for the fitting176 from sans.guitools.LineModel import LineModel177 model1 = LineModel()178 model2 = LineModel()179 180 #Do the fit181 182 fitter.set_model(model1,"M1",1, {'A':1,'B':1})183 fitter.set_data(data1,1)184 186 185 fitter.set_model(model2,"M2",2, {'A':1,'B':None})186 fitter.set_data(data2,2)187 188 189 chisqr2, out2, cov2,result= fitter.fit()190 print "chisqr2",chisqr2191 print "out2", out2192 print " cov2", cov2193 self.assert_(chisqr2)194 187 195 188 -
park_integration/test/testfitting.py
r4dd63eb r985c88b 72 72 73 73 #Do the fit SCIPY 74 model1.setParam( 'A', 2) 75 model1.setParam( 'B', 1) 74 76 fitter.set_data(data1,1) 75 fitter.set_model(model1,"M1",1, {'A':2,'B':1})77 fitter.set_model(model1,"M1",1,['A','B']) 76 78 77 79 chisqr1, out1, cov1=fitter.fit() … … 85 87 #Do the fit 86 88 fitter.set_data(data1,1) 87 fitter.set_model(model2,"M1",1,{'A':2,'B':1}) 89 model2.setParam( 'A', 2) 90 model2.setParam( 'B', 1) 91 fitter.set_model(model2,"M1",1,['A','B']) 88 92 89 chisqr2, out2, cov2 =fitter.fit(None,None)93 chisqr2, out2, cov2,result=fitter.fit(None,None) 90 94 91 95 self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2) -
park_integration/test/testpark.py
r4dd63eb r985c88b 40 40 41 41 #Do the fit 42 fitter.set_model(model1,"M1",1, {'A':2.5,'B':4}) 42 model1.setParam( 'A', 2.5) 43 model1.setParam( 'B', 4) 44 fitter.set_model(model1,"M1",1, ['A','B']) 43 45 fitter.set_data(data1,1) 44 46 45 fitter.set_model(model2,"M2",2, {'A':2,'B':3}) 47 model1.setParam( 'A', 2) 48 model1.setParam( 'B', 3) 49 fitter.set_model(model2,"M2",2, ['A','B']) 46 50 fitter.set_data(data2,2) 47 51 48 chisqr1, out1, cov1 = fitter.fit()52 chisqr1, out1, cov1,result= fitter.fit() 49 53 50 54 self.assert_(math.fabs(out1[1]-2.5)/math.sqrt(cov1[1][1]) < 2) … … 60 64 61 65 fitter.set_data(data3,1) 62 chisqr2, out2, cov2 = fitter.fit(None,None)66 chisqr2, out2, cov2, result= fitter.fit(None,None) 63 67 self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2) 64 68 print math.fabs(out2[0]-4.0)/math.sqrt(cov2[0][0]) … … 98 102 print chisqr1,chisqr2,chisqr3 99 103 #self.assertAlmostEquals(chisqr1,chisqr2) 104 self.assert_(chisqr1)
Note: See TracChangeset
for help on using the changeset viewer.