- Timestamp:
- Apr 4, 2014 5:21:52 PM (11 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:
- 9d6d5ba
- Parents:
- 084afb4
- Location:
- test/park_integration/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/park_integration/test/test_fit_cylinder.py
r6c00702 rda5d8e8 110 110 def test_park2(self): 111 111 """ Simultaneous cylinder model fit (park) """ 112 #raise NotImplementedError()112 raise NotImplementedError() 113 113 result1,= self._fit('park') 114 114 self.assert_(result1) -
test/park_integration/test/test_fit_line.py
r6c00702 rda5d8e8 19 19 #load data 20 20 data = Loader().load("testdata_line.txt") 21 data.name = data.filename 21 22 #Importing the Fit module 22 23 fitter = Fit('scipy') … … 37 38 fitter.set_model(model,1,pars1) 38 39 fitter.select_problem_for_fit(id=1,value=1) 39 result , = fitter.fit()40 41 self.assertTrue( math.fabs(result .pvec[0]-4)/3 <= result.stderr[0] )42 self.assertTrue( math.fabs(result .pvec[1]-2.5)/3 <= result.stderr[1])43 self.assertTrue( result .fitness/len(data.x) < 2 )40 result1, = fitter.fit() 41 42 self.assertTrue( math.fabs(result1.pvec[0]-4)/3 <= result1.stderr[0] ) 43 self.assertTrue( math.fabs(result1.pvec[1]-2.5)/3 <= result1.stderr[1]) 44 self.assertTrue( result1.fitness/len(data.x) < 2 ) 44 45 45 46 #fit with park test … … 48 49 fitter.set_model(model,1,pars1) 49 50 fitter.select_problem_for_fit(id=1,value=1) 50 result2 = fitter.fit()51 result2, = fitter.fit() 51 52 52 53 self.assert_(result2) … … 68 69 l = Loader() 69 70 data1=l.load("testdata_line.txt") 71 data1.name = data1.filename 70 72 71 73 data2=l.load("testdata_line1.txt") 74 data2.name = data2.filename 72 75 73 76 #Importing the Fit module … … 79 82 model11.name= "M2" 80 83 81 model1 = Model(model11 )82 model2 = Model(model22 )84 model1 = Model(model11,data1) 85 model2 = Model(model22,data2) 83 86 #fit with scipy test 84 87 pars1= ['A','B'] … … 93 96 except RuntimeError,msg: 94 97 assert str(msg)=="No Assembly scheduled for Scipy fitting." 95 else: raise Assert Error,"No error raised for scipy fitting with no model"98 else: raise AssertionError,"No error raised for scipy fitting with no model" 96 99 fitter.select_problem_for_fit(id=1,value=1) 97 100 fitter.select_problem_for_fit(id=2,value=1) … … 99 102 except RuntimeError,msg: 100 103 assert str(msg)=="Scipy can't fit more than a single fit problem at a time." 101 else: raise Assert Error,"No error raised for scipy fitting with more than 2 models"104 else: raise AssertionError,"No error raised for scipy fitting with more than 2 models" 102 105 103 106 #fit with park test … … 109 112 fitter.select_problem_for_fit(id=1,value=1) 110 113 fitter.select_problem_for_fit(id=2,value=1) 111 result2 = fitter.fit() 112 113 self.assert_(result2) 114 self.assertTrue( math.fabs(result2.pvec[0]-4)/3 <= result2.stderr[0] ) 115 self.assertTrue( math.fabs(result2.pvec[1]-2.5)/3 <= result2.stderr[1] ) 116 self.assertTrue( result2.fitness/(len(data1.x)+len(data2.x)) < 2) 114 R1,R2 = fitter.fit() 115 116 self.assertTrue( math.fabs(R1.pvec[0]-4)/3 <= R1.stderr[0] ) 117 self.assertTrue( math.fabs(R1.pvec[1]-2.5)/3 <= R1.stderr[1] ) 118 self.assertTrue( R1.fitness/(len(data1.x)+len(data2.x)) < 2) 117 119 118 120 … … 122 124 l = Loader() 123 125 data1= l.load("testdata_line.txt") 126 data1.name = data1.filename 124 127 data2= l.load("testdata_cst.txt") 128 data2.name = data2.filename 125 129 126 130 # Receives the type of model for the fitting … … 134 138 model22.setParam("value", 1.0) 135 139 136 model1 = Model(model11 )137 model2 = Model(model22 )140 model1 = Model(model11,data1) 141 model2 = Model(model22,data2) 138 142 model1.set(A=4) 139 143 model1.set(B=3) … … 153 157 fitter.select_problem_for_fit(id=2,value=1) 154 158 155 result2 = fitter.fit() 156 self.assert_(result2) 157 self.assertTrue( math.fabs(result2.pvec[0]-4.0)/3. <= result2.stderr[0]) 158 self.assertTrue( math.fabs(result2.pvec[1]-2.5)/3. <= result2.stderr[1]) 159 self.assertTrue( result2.fitness/(len(data1.x)+len(data2.x)) < 2) 159 R1,R2 = fitter.fit() 160 self.assertTrue( math.fabs(R1.pvec[0]-4.0)/3. <= R1.stderr[0]) 161 self.assertTrue( math.fabs(R1.pvec[1]-2.5)/3. <= R1.stderr[1]) 162 self.assertTrue( R1.fitness/(len(data1.x)+len(data2.x)) < 2) 160 163 161 164 … … 165 168 l = Loader() 166 169 data1 = l.load("testdata_line.txt") 170 data1.name = data1.filename 167 171 data2 = l.load("testdata_line1.txt") 168 169 172 data2.name = data2.filename 173 170 174 # Receives the type of model for the fitting 171 175 model1 = LineModel() … … 173 177 model1.setParam("A", 1.0) 174 178 model1.setParam("B",1.0) 175 model = Model(model1 )179 model = Model(model1,data1) 176 180 177 181 #fit with scipy test … … 197 201 fitter.set_data(data2,1,qmin=1,qmax=10) 198 202 fitter.select_problem_for_fit(id=1,value=1) 199 result2 = fitter.fit()203 result2, = fitter.fit() 200 204 201 205 self.assert_(result2)
Note: See TracChangeset
for help on using the changeset viewer.