SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

Convert models with embedded c code #513

Closed dehoni closed 2 years ago

dehoni commented 2 years ago

This PR converts the models that had embedded c code. The c code is relocated in a c model definition file. The issue with pure python models not being able to access magnetism and orientation will be resolved with PR58 when pure python models are translated to c automatically.

pkienzle commented 2 years ago

It's not clear to me why this change is needed. I support the embedded C code because it is much easier to pass around a single py file rather than a pair of c and py files. That doesn't matter for the builtin modules so no particular objection to this change, but if the infrastructure is broken so that embedded C code doesn't support some features I would like to know about it.

None of these models are shape models (no orientation or magnetism), so I'm not sure why this PR is relevant to #247.

butlerpd commented 2 years ago

agreed on updating author and verification. Somebody should look at comparing the old and new versions give the same result.

dehoni commented 2 years ago

Every model should have a test!

ru4en commented 2 years ago

All models in sasmodels/sasmodels/models tested successfully using python -m sasmodels.model_test

Sasmodels seem to build and install successfully as well, this was tested on a new vm. (Tested on Linux 5.15.0-43-generic Ubuntu)

Testing: dab.py
.
----------------------------------------------------------------------
Ran 1 test in 0.023s

OK
Testing: gaussian_peak.py
.
----------------------------------------------------------------------
Ran 1 test in 0.027s

OK
Testing: guinier.py
.
----------------------------------------------------------------------
Ran 1 test in 0.028s

OK
Testing: hardsphere.py
.
----------------------------------------------------------------------
Ran 1 test in 0.024s

OK
Testing: lamellar_hg.py
.
----------------------------------------------------------------------
Ran 1 test in 0.027s

OK
Testing: lorentz.py
.
----------------------------------------------------------------------
Ran 1 test in 0.023s

OK
Testing: squarewell.py
.
----------------------------------------------------------------------
Ran 1 test in 0.027s

OK
Testing: stickyhardsphere.py
.
----------------------------------------------------------------------
Ran 1 test in 0.024s

OK