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

update beta approx docs. Refs sasview/sasview#1164. #203

Merged
merged 1 commit into from
Mar 31, 2019

Conversation

pkienzle
Copy link
Contributor

See ticket SasView/sasview#1164.

This provides some explanation for the theory and parameters behind structure factor calculations.

Note: the screen shot in p_and_s_buttons.png showing how to set the structure factor belongs on the documentation for the fitting panel, which can refer to this doc for interpretation. I've left it in place for now.

@pkienzle pkienzle requested a review from smk78 March 31, 2019 04:52
@smk78
Copy link
Contributor

smk78 commented Mar 31, 2019

Ok, will move screen shot.

Copy link
Contributor

@smk78 smk78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built locally. Looks good. Richard also scanned it. Will approve and pull so that it can be tidied a bit.

@smk78 smk78 merged commit 8ed04ff into master Mar 31, 2019
@smk78 smk78 deleted the sasview-1164-beta-doc branch March 31, 2019 09:15
@pkienzle
Copy link
Contributor Author

Will approve and pull so that it can be tidied a bit.

Can't you tidy within the branch before pulling?

Or do you need it in master so that the builder can see it?

@smk78
Copy link
Contributor

smk78 commented Mar 31, 2019

Kind of. Changes now committed.

Nice work anyway, Paul. I have furtled them a bit, in particular: removing the screen shot (more on that in a mo), and reversing the order (I put your "theory" after the parameter descriptions because I thought a) that was more useful, and b) it wouldn't scare the **** out of the reader quite so quickly!).

The screenshot is now in fitting_help.rst, augmented by additional screenshots after Richard had pointed out to me the subtlety of the different ways of generating product models :-) . So I have also expanded this section of fitting_help as well.

@pkienzle
Copy link
Contributor Author

Okay, thanks for cleaning things up.

(1) volfraction is an exception in the following:

**If writing your own** $P@S$ **models, DO NOT give your model parameters**
**these names!*

(2) Rewrite

Structure factor models $S(Q)$ contain **volfraction**. In $P@S$ models
this is *also* used as the volume fraction for the form factor model
$P(Q)$, *replacing* any **volfraction** parameter in $P(Q)$. This means
that $P@S$ models can also leave **scale** at 1.0.

as

Structure factor models $S(Q)$ contain **volfraction**. In $P@S$ models
this is *also* used as the volume fraction for the form factor model
$P(Q)$, so these models can also leave **scale** at 1.0.  If $P(Q)$ already
has a **volfraction** parameter, it is tied to the **volfraction** for $S(Q)$.

(3) For radius_effective, I'm not sure what you mean by the following paragraph:

In use, it may be sensible to tie or constrain **radius_effective**
to one or other of the "size" parameters describing the form of the shape.

If you are suggesting the users set radius_effective_mode=0 and constraining radius_effective to some function of model parameters, then maybe merge with the next paragraph:

**radius_effective** may also be specified directly, independent of the
estimate from $P(Q)$.

Polydispersity won't work as expected in this case.

(4) radius_effective_mode and structure_factor_mode will be available in 4.3, so your note can be removed. Unfortunately, they need to be entered as integers rather than a dropdown (haven't looked at how hard that fix would be).

(5) I don't understand the following:

**WARNING! If** $P(Q)$ **is multiplied by** $S(Q)$ **in the FitPage,**
**instead of being generated in the Sum|Multi dialog, the**
**radius_effective used is constrained (equivalent to**
**radius_effective_mode = 1)**.

Sounds like you are saying that radius_effective_mode is only available in P*S models and that it constrains S.radius_effective, but is fixed at radius_effective_mode=1 for P@S models?

Or are you talking about editing saved product models and changing P*S to P@S? I can believe that the GUI will handle this one wrong, and fix radius_effective_mode=1.

Personally, I would remove the references to the FitPage and Sum|Multi dialog since they depend on the GUI you are using to display the model.

(6) 4.3 will allow beta approximation.

This mode is only
available in SasView 5.0 and later.

@smk78
Copy link
Contributor

smk78 commented Apr 2, 2019

  1. Ok, thanks. I misunderstood from Richard.

  2. Done

  3. Yes, I think that is what I meant. Changed accordingly.

  4. There was a discussion about this at Code Camp. I think the prevailing view was that beta(q) could be available in a versison of 4 provided it didn't require any GUI work (for which we do not have the resources) or a lot of effort elsewhere. And there was also the view that beta(q) is the thing to sell 5 on. But I've changed what is the doc to now say from 4.3, however, there is perhaps more discussion that needs to happen here...

  5. Will come back to this.

@smk78
Copy link
Contributor

smk78 commented Apr 2, 2019

  1. So this was how I interpreted what Richard had explained to me in the wake of his testing. But by the time I wrote it he had left! So it is entirely possible I've got the wrong end of the stick here. Richard?

@smk78
Copy link
Contributor

smk78 commented Apr 2, 2019

Yes, which is what Richard did by accident at Code Camp. As you say, it would function, albeit with scope for disaster in the hands of a typical user!

But I thought he told me that depending on where one generated the product model there was a difference in the radius_effective_mode that it used? But maybe I misunderstood...

When I run the new sasmodels under the old GUI I get structure_factor_mode and 
radius_effective_mode as parameters to the model.

The drop downs are missing (a problem since 4.0 that also affects onion model, etc.), 
and you can make them fitted parameters (even though that makes no sense), but it 
is good enough to run an analysis with.

 Paul

@smk78
Copy link
Contributor

smk78 commented Apr 2, 2019

Re When I run the new sasmodels under the old GUI I get structure_factor_mode and radius_effective_mode as parameters to the model.

Indeed I found this also, will add notes to the wiki tomorrow if I can find it, about the need 
to "git checkout v0.99" in sasmodels to build 4.x series sasview.

Discussion at code camp was that we are not going to introduce drop downs in 4.2 gui. 
Though tthe two mode parameter appear, I didn't check whther the calculations came back 
correct, and of coure 4.2 does not pull back in the actual vaule of radius_effective, nor 
without the drop down is there any way to tell what the mode params are supposed 
to do without looking at the source code of the model.

Richard

@smk78
Copy link
Contributor

smk78 commented Apr 2, 2019

Just tested: It defaults to effective_radius_mode=1 both in saved P@S model (see below), 
and when setting P and S on the fit page.

The saved file for P@S on the fit page contains the correct value for radius_effective_mode, 
but I was unable to load the project.  Not sure if this is a new error with save/load P@S 
projects, or if it is still the errors that Jeff is working on.

  Paul


PS.py:

from sasmodels.core import load_model_info from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('sphere@hardsphere')
model_info.name = 'PS'
Model = make_model_from_info(model_info)


> On Apr 1, 2019, at 5:45 PM, Richard wrote:
> 
> In product, then radius_effective-mode defaults to zero, but in the 
> simple fit panel introducing an S(Q) defaults to 1 (at least in 4.2, 
> and I've forgotten what happens in 5.0, and I'm on home email ...)
> 
> In mixture then of course its not relevant.
> 
> Richard
> 
> 
> 
> radius_effective_mode only shows up in product model, not in mixture model. 
Similarly,  S.radius_effective is only tied to P.radius_effective in product model, 
not in mixture model.  Beyond that, I don't know what Richard was describing.
> 
> 
> $ # Product model
> $ sascomp "sphere@hardsphere" -pars -noplot
> scale: 1
> background: 0.001
> sld: 1
> sld_solvent: 6
> radius: 50
> radius_effective: 50
> volfraction: 0.2
> structure_factor_mode: 0
> radius_effective_mode: 1
> up_frac_i: 0
> up_frac_f: 0
> up_angle: 0
> 
> $ # Mixture model
> $ sascomp "sphere*hardsphere" -pars -noplot
> scale: 1
> background: 0.001
> A_sld: 1
> A_sld_solvent: 6
> A_radius: 50
> B_radius_effective: 50
> B_volfraction: 0.2
> up_frac_i: 0
> up_frac_f: 0
> up_angle: 0
> 
> 
> BTW, I'm guessing that getting the drop-downs to work in SasView 4.x wouldn't 
be too hard.  We already support a dropdown for spherical_sld function (unlike what I said before).
> 
> Paul

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

Successfully merging this pull request may close these issues.

2 participants