Changeset ecb485c in sasmodels
- Timestamp:
- Jan 26, 2018 8:16:16 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- bb4ff2a
- Parents:
- a69d8cd (diff), ecf895e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/mixture.py
r7fec3b7 recf895e 94 94 # If model is a sum model, each constituent model gets its own scale parameter 95 95 scale_prefix = prefix 96 if prefix == '' and hasattr(part,"operation") and part.operation== '*':96 if prefix == '' and getattr(part, "operation", '') == '*': 97 97 # `part` is a composition product model. Find the prefixes of 98 # it's parameters to form a new prefix for the scale , eg:99 # a model with A*B*C will have ABC_scale98 # it's parameters to form a new prefix for the scale. 99 # For example, a model with A*B*C will have ABC_scale. 100 100 sub_prefixes = [] 101 101 for param in part.parameters.kernel_parameters: -
sasmodels/modelinfo.py
r108e70e r95498a3 69 69 processed.append(parse_parameter(*p)) 70 70 partable = ParameterTable(processed) 71 partable.check_angles() 71 72 return partable 72 73 … … 421 422 # type: (List[Parameter]) -> None 422 423 self.kernel_parameters = parameters 423 self._check_angles()424 424 self._set_vector_lengths() 425 425 … … 471 471 self.pd_2d = set(p.name for p in self.call_parameters if p.polydisperse) 472 472 473 def _check_angles(self): 473 def check_angles(self): 474 """ 475 Check that orientation angles are theta, phi and possibly psi. 476 """ 474 477 theta = phi = psi = -1 475 478 for k, p in enumerate(self.kernel_parameters): … … 494 497 if psi >= 0 and psi != phi+1: 495 498 raise TypeError("psi must follow phi") 496 #if (psi >= 0 and psi != last_par) or (psi < 0 and phi != last_par):497 #raise TypeError("orientation parameters must appear at the "498 #"end of the parameter table")499 if (psi >= 0 and psi != last_par) or (psi < 0 and phi != last_par): 500 raise TypeError("orientation parameters must appear at the " 501 "end of the parameter table") 499 502 elif theta >= 0 or phi >= 0 or psi >= 0: 500 503 raise TypeError("oriented shapes must have both theta and phi and maybe psi") -
.travis.yml
r2d09df1 ra69d8cd 37 37 - conda update --yes conda 38 38 - conda info -a 39 - conda install --yes python=$PY numpy scipy cython mako cffi 39 # 2018-01-26 PAK: sasmodels uses yield generator for tests, which isn't supported in pytest 4+ 40 - conda install --yes python=$PY numpy scipy cython mako cffi "pytest<4" 40 41 install: 41 42 - pip install bumps … … 43 44 script: 44 45 - python --version 45 - python -m sasmodels.model_test -v dll all 46 #- python -m sasmodels.model_test -v dll all 47 - python -m pytest -v 46 48 before_deploy: 47 49 - echo -e "Host danse.chem.utk.edu\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config -
appveyor.yml
rfefc185 ra69d8cd 44 44 45 45 install: 46 # Set the CONDA_NPY, although it has no impact on the actual build. 46 # Set the CONDA_NPY, although it has no impact on the actual build. 47 47 # We need this because of a test within conda-build. 48 48 - cmd: set CONDA_NPY=19 … … 68 68 #- cmd: conda install --yes --quiet obvious-ci 69 69 # 2018-01-19 PAK: skipping toolchain cython and cffi (these were for pyopencl?) 70 - cmd: conda install --yes --quiet numpy scipy 70 # 2018-01-26 PAK: sasmodels uses yield generator for tests, which isn't supported in pytest 4+ 71 - cmd: conda install --yes --quiet numpy scipy "pytest<4" 71 72 # 2018-01-19 PAK: skipping pyopencl; this would be needed for deploy but maybe not for test 72 73 #- cmd: conda install --yes --channel conda-forge pyopencl … … 86 87 #- "%CMD_IN_ENV% python -m sasmodels.model_test dll all" 87 88 #- cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd python -m sasmoels.model_test dll all 88 - python -m sasmodels.model_test dll all 89 #- python -m sasmodels.model_test dll all 90 #- nosetests -v sasmodels/*.py 91 - python -m pytest -v -
sasmodels/convert.py
r2d81cfe ra69d8cd 633 633 def test_backward_forward(): 634 634 from .core import list_models 635 L = lambda name: _check_one(name, seed=1) 635 636 for name in list_models('all'): 636 L = lambda: _check_one(name, seed=1) 637 L.description = name 638 yield L 637 yield L, name -
sasmodels/core.py
r7a516d0 ra69d8cd 320 320 print("\n".join(list_models(kind))) 321 321 322 def test_load(): 323 # type: () -> None 324 """Check that model load works""" 322 def test_composite_order(): 325 323 def test_models(fst, snd): 326 324 """Confirm that two models produce the same parameters""" 327 325 fst = load_model(fst) 328 326 snd = load_model(snd) 329 # Remove the upper case characters frin the parameters, since 330 # they lasndel the order of events and we specfically are 331 # changin that aspect 327 # Un-disambiguate parameter names so that we can check if the same 328 # parameters are in a pair of composite models. Since each parameter in 329 # the mixture model is tagged as e.g., A_sld, we ought to use a 330 # regex subsitution s/^[A-Z]+_/_/, but removing all uppercase letters 331 # is good enough. 332 332 fst = [[x for x in p.name if x == x.lower()] for p in fst.info.parameters.kernel_parameters] 333 333 snd = [[x for x in p.name if x == x.lower()] for p in snd.info.parameters.kernel_parameters] 334 334 assert sorted(fst) == sorted(snd), "{} != {}".format(fst, snd) 335 335 336 337 test_models( 336 def build_test(first, second): 337 test = lambda description: test_models(first, second) 338 description = first + " vs. " + second 339 return test, description 340 341 yield build_test( 338 342 "cylinder+sphere", 339 343 "sphere+cylinder") 340 test_models(344 yield build_test( 341 345 "cylinder*sphere", 342 346 "sphere*cylinder") 343 test_models(347 yield build_test( 344 348 "cylinder@hardsphere*sphere", 345 349 "sphere*cylinder@hardsphere") 346 test_models(350 yield build_test( 347 351 "barbell+sphere*cylinder@hardsphere", 348 352 "sphere*cylinder@hardsphere+barbell") 349 test_models(353 yield build_test( 350 354 "barbell+cylinder@hardsphere*sphere", 351 355 "cylinder@hardsphere*sphere+barbell") 352 test_models(356 yield build_test( 353 357 "barbell+sphere*cylinder@hardsphere", 354 358 "barbell+cylinder@hardsphere*sphere") 355 test_models(359 yield build_test( 356 360 "sphere*cylinder@hardsphere+barbell", 357 361 "cylinder@hardsphere*sphere+barbell") 358 test_models(362 yield build_test( 359 363 "barbell+sphere*cylinder@hardsphere", 360 364 "cylinder@hardsphere*sphere+barbell") 361 test_models(365 yield build_test( 362 366 "barbell+cylinder@hardsphere*sphere", 363 367 "sphere*cylinder@hardsphere+barbell") 364 368 369 def test_composite(): 370 # type: () -> None 371 """Check that model load works""" 365 372 #Test the the model produces the parameters that we would expect 366 373 model = load_model("cylinder@hardsphere*sphere") -
sasmodels/model_test.py
r2d81cfe ra69d8cd 123 123 124 124 if is_py: # kernel implemented in python 125 test_name = " Model: %s, Kernel:python"%model_name125 test_name = "%s-python"%model_name 126 126 test_method_name = "test_%s_python" % model_info.id 127 127 test = ModelTestCase(test_name, model_info, … … 135 135 # test using dll if desired 136 136 if 'dll' in loaders or not core.HAVE_OPENCL: 137 test_name = " Model: %s, Kernel:dll"%model_name137 test_name = "%s-dll"%model_name 138 138 test_method_name = "test_%s_dll" % model_info.id 139 139 test = ModelTestCase(test_name, model_info, … … 146 146 # test using opencl if desired and available 147 147 if 'opencl' in loaders and core.HAVE_OPENCL: 148 test_name = " Model: %s, Kernel: OpenCL"%model_name148 test_name = "%s-opencl"%model_name 149 149 test_method_name = "test_%s_opencl" % model_info.id 150 150 # Using dtype=None so that the models that are only … … 469 469 loaders = ['opencl', 'dll'] if core.HAVE_OPENCL else ['dll'] 470 470 tests = make_suite(loaders, ['all']) 471 for test_i in tests: 472 # In order for nosetest to see the correct test name, need to set 473 # the description attribute of the returned function. Since we 474 # can't do this for the returned instance, wrap it in a lambda and 475 # set the description on the lambda. Otherwise we could just do: 476 # yield test_i.run_all 477 L = lambda: test_i.run_all() 478 L.description = test_i.test_name 479 yield L 471 for test in tests: 472 # In order for nosetest to show the test name, wrap the test.run_all 473 # instance in function that takes the test name as a parameter which 474 # will be displayed when the test is run. 475 yield lambda name: test.run_all(), test.test_name 480 476 481 477 -
sasmodels/sasview_model.py
r2d81cfe ra69d8cd 859 859 # type: () -> None 860 860 """ 861 Load and run cylinder model from sas.models.CylinderModel861 Load and run cylinder model as sas-models-CylinderModel 862 862 """ 863 863 if not SUPPORT_OLD_STYLE_PLUGINS:
Note: See TracChangeset
for help on using the changeset viewer.