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

truncated sphere model simulation #531

Closed pkienzle closed 1 year ago

pkienzle commented 1 year ago

Add truncated sphere to the set of model simulations so we have an asymmetric shape to play with. All other shapes are symmetric about a-b-c planes.

This has no impact on the installed library.

wpotrzebowski commented 1 year ago

Thinking about validating the model/results. I've generated STL model with meshlab of half-sphere and calulatet SAS profile using (https://github.com/molybd/Model2SAS). half_sphere00 Figure_1

Not sure if this is the way to go?

butlerpd commented 1 year ago

Need to discuss how to test with @pkienzle

pkienzle commented 1 year ago

The purpose of this code was to check which symmetries in the 2D scattering pattern would disappear for some choice of (θ, φ, ψ) when the shape had an axis that was not mirror-reflecting. This has something to do with the calculation of slit resolution for oriented usans but I don't remember the details.

My validation was visual: did the generated MC points land within the truncated sphere? Yes.

Do we need a unit test for this? No. It is not production code that we ship as part of sasmodels.

There is a larger discussion about how we manage model validation but it is outside the scope of this PR. For example, molydb checks could be done alongside the MC checks, particularly if we add code to each model to render it as a mesh as part of the orientation viewer. This is outside the scope of this PR.

butlerpd commented 1 year ago

I believe the question was how to do an independent PR review. Though as you point out @pkienzle, it is not expected to be "production code." I guess a look at the code would suffice though @wpotrzebowski seems to have prepared something that seems like he should be able to use it to test the functionality? Again, I suppose we could just skip any review on this type of thing?

That said I'm confused by the purpose statement. I thought by definition any scattering event (as opposed to reflectivity event) must have at least a center of inversion symmetry? Isn't that how we know something is not a scattering event?

pkienzle commented 1 year ago

That said I'm confused by the purpose statement. I thought by definition any scattering event (as opposed to reflectivity event) must have at least a center of inversion symmetry? Isn't that how we know something is not a scattering event?

So you said. But I'm neither a physicist nor a mathematician and I have no idea what your statement means. It was, however, pretty easy to toss five lines of code into the existing infrastructure so I could look for a counterexample. And another few lines to fix a plotting bug 8-)

You can see the result using:

python explore/realspace.py -p -d2 -v70,0,0 -s50000 tsphere h=-0.5
butlerpd commented 1 year ago

@krzywon to sort out