Changeset 823e620 in sasmodels for sasmodels/model_test.py
- Timestamp:
- Jan 29, 2016 8:46:54 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- eafc9fa
- Parents:
- 803f835
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r9404dd3 r823e620 9 9 if model1 is 'all', then all except the remaining models will be tested 10 10 11 Each model is tested using the default parameters at q=0.1, (qx, qy)=(0.1,0.1),11 Each model is tested using the default parameters at q=0.1, (qx, qy)=(0.1, 0.1), 12 12 and the ER and VR are computed. The return values at these points are not 13 13 considered. The test is only to verify that the models run to completion, … … 30 30 [ {parameters}, (qx, qy), I(qx, Iqy)], 31 31 [ {parameters}, [(qx1, qy1), (qx2, qy2), ...], 32 [I(qx1, qy1), I(qx2,qy2), ...]],32 [I(qx1, qy1), I(qx2, qy2), ...]], 33 33 34 34 [ {parameters}, 'ER', ER(pars) ], … … 75 75 # don't try to call cl kernel since it will not be 76 76 # available in some environmentes. 77 is_py = callable(getattr(model_definition, 'Iq', None))77 is_py = callable(getattr(model_definition, 'Iq', None)) 78 78 79 79 if is_py: # kernel implemented in python … … 123 123 def _runTest(self): 124 124 smoke_tests = [ 125 [{}, 0.1,None],126 [{}, (0.1,0.1),None],127 [{}, 'ER',None],128 [{}, 'VR',None],125 [{}, 0.1, None], 126 [{}, (0.1, 0.1), None], 127 [{}, 'ER', None], 128 [{}, 'VR', None], 129 129 ] 130 130 … … 163 163 actual = [call_VR(model.info, pars)] 164 164 elif isinstance(x[0], tuple): 165 Qx, Qy = zip(*x)165 Qx, Qy = zip(*x) 166 166 q_vectors = [np.array(Qx), np.array(Qy)] 167 167 kernel = make_kernel(model, q_vectors) … … 179 179 # smoke test --- make sure it runs and produces a value 180 180 self.assertTrue(np.isfinite(actual_yi), 181 'invalid f(%s): %s' % (xi, actual_yi))181 'invalid f(%s): %s' % (xi, actual_yi)) 182 182 else: 183 183 err = abs(yi - actual_yi) 184 184 nrm = abs(yi) 185 185 self.assertLess(err * 10**5, nrm, 186 'f(%s); expected:%s; actual:%s' % (xi, yi, actual_yi)) 186 'f(%s); expected:%s; actual:%s' 187 % (xi, yi, actual_yi)) 187 188 188 189 return ModelTestCase … … 237 238 Run "nosetests sasmodels" on the command line to invoke it. 238 239 """ 239 tests = make_suite(['opencl', 'dll'],['all'])240 tests = make_suite(['opencl', 'dll'], ['all']) 240 241 for test_i in tests: 241 242 yield test_i._runTest
Note: See TracChangeset
for help on using the changeset viewer.