Changeset 39a06c9 in sasmodels for sasmodels/model_test.py
- Timestamp:
- Oct 25, 2018 5:58:26 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 81751c2
- Parents:
- 304c775
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r304c775 r39a06c9 10 10 11 11 Each model is tested using the default parameters at q=0.1, (qx, qy)=(0.1, 0.1), 12 and the ER and VR are computed. The return values at these points are not13 considered. The test is only to verify that the models run to completion, 14 and do not produce inf or NaN.12 and Fq is called to make sure R_eff, volume and volume ratio are computed. 13 The return values at these points are not considered. The test is only to 14 verify that the models run to completion, and do not produce inf or NaN. 15 15 16 16 Tests are defined with the *tests* attribute in the model.py file. *tests* 17 17 is a list of individual tests to run, where each test consists of the 18 18 parameter values for the test, the q-values and the expected results. For 19 the effective radius test, the q-value should be 'ER'. For the VR test, 20 the q-value should be 'VR'. For 1-D tests, either specify the q value or 21 a list of q-values, and the corresponding I(q) value, or list of I(q) values. 19 the effective radius test and volume ratio tests, use the extended output 20 form, which checks each output of kernel.Fq. For 1-D tests, either specify 21 the q value or a list of q-values, and the corresponding I(q) value, or 22 list of I(q) values. 22 23 23 24 That is:: … … 32 33 [I(qx1, qy1), I(qx2, qy2), ...]], 33 34 34 [ {parameters}, 'ER', ER(pars) ], 35 [ {parameters}, 'VR', VR(pars) ], 35 [ {parameters}, q, F(q), F^2(q), R_eff, V, V_r ], 36 36 ... 37 37 ] … … 214 214 ({}, [0.001, 0.01, 0.1], [None]*3), 215 215 ({}, [(0.1, 0.1)]*2, [None]*2), 216 # test that ER/VR will run if they exist216 # test that Fq will run 217 217 ({}, 0.1, None, None, None, None, None), 218 218 ] … … 249 249 def _find_missing_tests(self): 250 250 # type: () -> None 251 """make sure there are 1D, 2D, ER and VR tests as appropriate""" 252 model_has_VR = callable(self.info.VR) 253 model_has_ER = callable(self.info.ER) 251 """make sure there are 1D and 2D tests as appropriate""" 254 252 model_has_1D = True 255 253 model_has_2D = any(p.type == 'orientation' … … 259 257 single = [test for test in self.info.tests 260 258 if not isinstance(test[2], list) and test[2] is not None] 261 tests_has_VR = any(test[1] == 'VR' for test in single)262 tests_has_ER = any(test[1] == 'ER' for test in single)263 259 tests_has_1D_single = any(isinstance(test[1], float) for test in single) 264 260 tests_has_2D_single = any(isinstance(test[1], tuple) for test in single) … … 273 269 274 270 missing = [] 275 if model_has_VR and not tests_has_VR:276 missing.append("VR")277 if model_has_ER and not tests_has_ER:278 missing.append("ER")279 271 if model_has_1D and not (tests_has_1D_single or tests_has_1D_multiple): 280 272 missing.append("1D")
Note: See TracChangeset
for help on using the changeset viewer.