Changeset 985c88b in sasview for park_integration/test/test_fitting_panel.py
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.