Opened 6 years ago
Closed 6 years ago
#1157 closed defect (fixed)
force background to 0.0 for structure factors
Reported by: | pkienzle | Owned by: | pkienzle |
---|---|---|---|
Priority: | minor | Milestone: | SasView 4.3.0 |
Component: | SasView | Keywords: | |
Cc: | Work Package: | SasView Bug Fixing |
Description
The scale and background parameters are still present in the model in sasmodels, they are just invisible to the interface in sasview.
Unfortunately, it appears that the default value for background for structure factor is 0.001 and there is no way to change it from sasview. Need to force it to zero within the model.
Tests should not specify background=0 in order to verify that 0 is the default value.
Note that the parameters are only hidden to sasview via sasview_model.py, they are not registered as hidden within sasmodels. This means sascomp hardsphere -pars will show the defaults. May want to hide the parameters within sasmodels itself, once the default has been corrected.
Change History (11)
comment:1 Changed 6 years ago by pkienzle
comment:2 Changed 6 years ago by pkienzle
- Owner set to pkienzle
- Status changed from new to assigned
comment:3 Changed 6 years ago by butler
So question is whether to leave as two fudge factors? My vote would be no but others might have different opinion? If the high Q does not go to 1 it is not the S(Q). Presumably if one is pulling out a part from the whole the part is the part. Actual experiments include background and scale but the parts should not.
comment:4 Changed 6 years ago by richardh
I would leave scale and background, as users will likely have done I(high conc)/I(low conc) but not rescaled to 1.0 at high Q.
If we want to avoid a "special case" in the interface for fitting just an S(Q) then we could have a P(Q) "none - to use with S(Q)" which is just a scalar, with ideally its background having max=min=0 by default, then fit P(Q)S(Q) in the normal way.
Later on when we have introduced "experimental backgrounds" so users can fit the difference between two I(Q), then we could do the same for a ratio to fit
S(Q) = scale * (Ia(Q)-BKGa)/ (Ib(Q)-BKGb) + Bkg where Bkg is by default max=min=0
comment:5 Changed 6 years ago by smk78
I was also thinking that if you were just working with S(Q) there might be instances where, in the interests of clarity, you want to displace the curve? Having a background would allow that.
comment:6 Changed 6 years ago by butler
I agree with @smk78 about sometimes wanting to offset but all the use cases for that I know of have to do with graphical presentation not fitting. Thus this would be a plotting enhancement ticket and not relating to fitting.
regarding @richardh, it is true that concentration normalization may sometimes be forgotten by the user (though we can still scale a curve using the math tools so not sure it is necessary to have here). However the use better be subtracting the background before dividing or they will get nonsense (unless of course Ia(Q)>>>background but in that case we don't need it in S(Q) either). (Ia(Q)-BKGa)/(Ib(Q)-BKGb(Q)) is not the same as Ia(Q)/Ib(Q) - BKG!!!
That said .. not sure what @pkienzle was getting at in the question. As I understand it both scale and background remain in fact part of S(q) model but are simply suppressed at the interface. they are still available to the scripting interface for power users. The point of the ticket originally was to make sure the (suppressed) background was set to 0?
comment:7 Changed 6 years ago by richardh
Often the users don't know the precise concs, so having a scale is useful.
I was only looking far ahead when I suggested a fit for
S(Q) = scale * (Ia(Q)-BKGa)/ (Ib(Q)-BKGb) + Bkg
which is what users actually have to do, fit flat background to both data sets, and adjust scale to be their concentration ratio (and where the final Bkg is by default max=min=0, i.e. ought to be zero).
What are your thoughts on having a P(Q) = "none" to simplify the code ?
comment:8 Changed 6 years ago by butler
Setting P(Q) to none is an interesting idea. I'm not sure it makes the code simpler but it may (or may not) make it simpler for the new user to work with? We should consider it at any rate. I am in fact beginning to get concerned that as we add important features we are making the interface less accessible to "non-professional" scatterers. GUIs are such a hard thing……
comment:9 Changed 6 years ago by butler
- Priority changed from major to blocker
At this point all remaining tickets should either be blockers or critical. Critical would be those that do not stop the actual release but need to be dealt with soon after such as updating the marketplace. Tickets such as this are blockers in that if not fixed the docs need to have an appropriate warning in them for this release. Once that is fixed the ticket moves to 4.3 if it is not closed.
comment:10 Changed 6 years ago by pkienzle
- Milestone changed from SasView 4.2.0 to SasView 4.3.0
- Priority changed from blocker to minor
Apparently this is only an issue in sasmodels. The sasview wrapper was already setting the default background to zero.
comment:11 Changed 6 years ago by GitHub <noreply@…>
- Resolution set to fixed
- Status changed from assigned to closed
Should background and scale should be absent from sasview for pure structure factor models?
If a user is trying to fit a structure factor directly after division of concentrated over a dilute solution measurement, having background and scale available as fit parameters may be necessary.