Changeset 8bbab51 in sasview for park_integration
- Timestamp:
- Sep 30, 2008 10:34:36 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:
- 948add7
- Parents:
- a9e04aa
- Location:
- park_integration/test
- Files:
-
- 3 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
park_integration/test/test_fit_cylinder.py
r822f97e r8bbab51 29 29 pars1 =['length','radius','scale'] 30 30 fitter.set_data(data,1) 31 model. model.setParam('scale',1e-10)31 model.set(scale=1e-10) 32 32 fitter.set_model(model,1,pars1) 33 fitter.select_problem_for_fit(Uid=1,value=1) 33 34 result1 = fitter.fit() 34 35 … … 52 53 from sans.models.CylinderModel import CylinderModel 53 54 model1 = CylinderModel() 54 model1.setParam('contrast', 1)55 55 56 data = Data(sans_data=data1) 56 57 model = Model(model1) … … 58 59 pars1 =['length','radius','scale'] 59 60 fitter.set_data(data,1) 60 model.model.setParam('scale',1e-10) 61 model.set(contrast= 1) 62 model.set(scale=1e-10) 61 63 fitter.set_model(model,1,pars1) 64 fitter.select_problem_for_fit(Uid=1,value=1) 62 65 result1 = fitter.fit() 63 66 … … 87 90 cyl1 = CylinderModel() 88 91 cyl1.name = "C1" 89 cyl1.setParam('contrast', 1) 90 cyl1.setParam('scale', 1e-10) 92 91 93 data1 = Data(sans_data=data1) 92 94 model1 = Model(cyl1) 95 model1.set(contrast=1) 96 model1.set(scale= 1e-10) 93 97 fitter.set_data(data1,1) 94 98 fitter.set_model(model1, 1, ['length','radius','scale']) … … 96 100 cyl2 = CylinderModel() 97 101 cyl2.name = "C2" 98 cyl2.setParam('contrast', 1) 99 cyl2.setParam('scale', 1e-10) 102 100 103 data2 = Data(sans_data=data2) 101 104 # This is wrong. We should not store string as … … 108 111 model2 = Model(cyl2) 109 112 model2.set(length='C1.length') 110 113 model2.set(contrast=1) 114 model2.set(scale= 1e-10) 111 115 fitter.set_data(data2,2) 112 116 fitter.set_model(model2, 2, ['radius','scale']) 113 117 fitter.select_problem_for_fit(Uid=1,value=1) 118 fitter.select_problem_for_fit(Uid=2,value=1) 114 119 result1 = fitter.fit() 115 120 -
park_integration/test/test_fit_line.py
r6aa47df r8bbab51 10 10 """ test fitting """ 11 11 def test1(self): 12 """ Fit 1 data (testdata_line.txt)and 1 model(lineModel) 12 """ Fit 1 data (testdata_line.txt)and 1 model(lineModel) """ 13 13 #load data 14 14 from DataLoader.loader import Loader … … 34 34 pars1= ['A','B'] 35 35 fitter.set_model(model,1,pars1) 36 fitter.select_problem_for_fit(Uid=1,value=1) 36 37 result1 = fitter.fit() 37 38 self.assert_(result1) … … 48 49 fitter.set_data(data,1) 49 50 fitter.set_model(model,1,pars1) 51 fitter.select_problem_for_fit(Uid=1,value=1) 50 52 result2 = fitter.fit() 51 53 … … 91 93 fitter.set_data(data1,1) 92 94 fitter.set_model(model1,1,pars1) 95 fitter.select_problem_for_fit(Uid=1,value=0) 93 96 fitter.set_data(data2,2) 94 97 fitter.set_model(model2,2,pars1) 98 fitter.select_problem_for_fit(Uid=2,value=0) 99 100 try: result1 = fitter.fit() 101 except RuntimeError,msg: 102 assert str(msg)=="No Assembly scheduled for Scipy fitting." 103 else: raise AssertError,"No error raised for scipy fitting with no model" 104 fitter.select_problem_for_fit(Uid=1,value=1) 105 fitter.select_problem_for_fit(Uid=2,value=1) 95 106 try: result1 = fitter.fit() 96 107 except RuntimeError,msg: … … 104 115 fitter.set_data(data2,2) 105 116 fitter.set_model(model2,2,pars1) 117 fitter.select_problem_for_fit(Uid=1,value=1) 118 fitter.select_problem_for_fit(Uid=2,value=1) 106 119 result2 = fitter.fit() 107 120 … … 132 145 model11 = LineModel() 133 146 model11.name= "line" 134 model11.setParam('A',4) 135 model11.setParam('B',3) 147 136 148 model22 = Constant() 137 149 model22.name= "cst" 138 150 # Constrain the constant value to be equal to parameter B (the real value is 2.5) 139 model22.setParam('value','line.B')151 140 152 141 153 data1 = Data(sans_data=data11 ) … … 143 155 model1 = Model(model11) 144 156 model2 = Model(model22) 157 model1.set(A=4) 158 model1.set(B=3) 159 model2.set(value='line.B') 145 160 #fit with scipy test 146 161 pars1= ['A','B'] … … 151 166 fitter.set_data(data2,2) 152 167 fitter.set_model(model2,2,pars2) 168 fitter.select_problem_for_fit(Uid=1,value=1) 169 fitter.select_problem_for_fit(Uid=2,value=1) 153 170 154 171 result2 = fitter.fit() … … 186 203 fitter.set_model(model,1,pars1) 187 204 fitter.set_data(data2,1,qmin=1,qmax=10) 205 fitter.select_problem_for_fit(Uid=1,value=1) 188 206 189 207 result1 = fitter.fit() … … 203 221 fitter.set_model(model,1,pars1) 204 222 fitter.set_data(data2,1,qmin=1,qmax=10) 205 223 fitter.select_problem_for_fit(Uid=1,value=1) 206 224 result2 = fitter.fit() 207 225
Note: See TracChangeset
for help on using the changeset viewer.