Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newmodels0923 branch #581

Open
RichardHeenan opened this issue Sep 20, 2023 · 3 comments
Open

newmodels0923 branch #581

RichardHeenan opened this issue Sep 20, 2023 · 3 comments

Comments

@RichardHeenan
Copy link
Contributor

Leaving some notes re RIchard's newmodels0923 branch

These are models which have mostly been in existence for several years and been tested by the individual user groups for which they were written.

core_shell_ellipsoid_tied Sasview v4 version is on marketplace, has here been updated to v5 with F(Q). This and the following model really need a way to return information to the user, see the docs for my work around.

core_shell_flexible_cylinder_tied

core_shell_bicelle_elliptical_protein

core_shell_fuzzy_sphere

core_multi_shell_cylinder This is a multiplicity model
This has separate axial and radial sld profiles, have fudged them so they appear on the single sld plot.
Needs a proper method to have them in different colours. The data is collected by getProfile in
sasmodels\sasmodels\sasview_model.py
[ separate note that the sphere version, core_multi_shell has no unit tests]

lamellar_x5_paracrystal_kr Does a sum of monolayer plus stacks of 2, 3, 4,and 5 layers. Works surprisingly well on many lamellar
systems. This still needs proper documentation - in progress.

@RichardHeenan
Copy link
Contributor Author

Help needed please - in my newmodels0923 branch of sasmodels
core_shell_ellipsoid_tied.c
core_shell_flexible_cylinder_tied.c
have some printf( ...) for my work around to give users the shell thickness etc calculated by the model.
On my local dev build these prints go to the sasview.log file, but in my downloadable install built on github they go neither to the on screen log nor to the log file, sending them to the on screen log would be good, but how to do this? (When I first tried this some while back the printf results appeared in both from my local dev build.)

@pkienzle
Copy link
Contributor

The easiest path forward I see for this problem is to implement something akin to the handling of the weighted volume and effective radius calculations.

That is, we could extend the results vector returned from the kernel with weighted values for each derived parameter. For completeness we could also average over the input parameter values.

Modify kernel.py to pull these values out of the results and create a self.results method to compute weighted sum over the total weight.

This is the same (hack) mechanism we use to return P(Q) and S(Q) when computing P@S.

As a simple test I modified Kernel.Fq in sasmodels/kernel.py, adding the following just before the return statement:

self.results = lambda: {'form_volume': form_volume, 'shell_volume': shell_volume}

This makes these values available to the GUI but they are being ignored. Note that the P@S calculator already forwards these as results['P(Q) parts'] to the sasview GUI, so the results tree should allow for multiple levels.

@pkienzle
Copy link
Contributor

As for how to handle the problem right now, instead of printing shell thickness, you can return it as I(Q)

if(f_solvent_in_shell < -1.0e-24){
    *F1 = 1.0;
    *F2 = thick_shell;
    return;
}

Unfortunately you also have to set scale=1 and background=0 for the value to be correct.

Presumably you want number density average for the thick. In other models we do this by returning V²F²(Q), which results in I(Q) = φΣwVF²(Q)/ΣwV.

Note: Your tied cylinder code is using V=1/√2 instead of form_volume, so your I(Q) calculation will be:

 φΣ(wF²(Q)/(2V))/ΣwV

Is this what you intended?

Further note: Iqac uses V² = 1 instead of V² = 1/2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants