Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1112 closed defect (fixed)

Guinier model does not allow negative Rg^2^

Reported by: butler Owned by: tcbennun
Priority: major Milestone: SasView 4.2.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

After the Stuhrmann Analysis experiment for the NIST summer school it has been noted that the Gunier model in SasView is technically not generally correct as it does not allow for a negative Rg2. While this is not seen very often, it is the basis of Stuhrmann analysis and happens essentially with heterogeneous scattering length densities near the contrast point. In the short term some update to the documentation would be good. In the longer term we should think about making Rg2 the fit parameter.

Attachments (1)

guinier_docs_preview.png (28.0 KB) - added by tcbennun 6 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by butler

  • Milestone changed from SasView 4.2.0 to SasView 4.3.0

oops … not a 4.2 item clearly.

comment:2 Changed 6 years ago by richardh

Suggest for backwards compatibilty that we allow negative Rg value, and change the exponent so that

Rg_Squared = abs(Rg)*Rg

I will assign this to our student as an intro to sasview.

comment:3 follow-up: Changed 6 years ago by richardh

Negative Rg^2 has been sorted in sasmodels ticket-1112 branch

However when I build the docs the demo plot goes down to 10^-300 as seems not to pick up the flat background of 0.001, this needs further investigation.

comment:4 Changed 6 years ago by tcbennun

  • Owner set to tcbennun
  • Status changed from new to assigned

comment:5 in reply to: ↑ 3 Changed 6 years ago by tcbennun

Replying to richardh:

Negative Rg^2 has been sorted in sasmodels ticket-1112 branch

However when I build the docs the demo plot goes down to 10^-300 as seems not to pick up the flat background of 0.001, this needs further investigation.

The 'demo' parameters are not currently used to generate the documentation plots. These plots take the default parameter values from the model file and only ever apply background=0 (as far as I can see?)

Does this warrant a separate ticket? Do we want to be able to specify background (and scale?) parameters for the documentation plots, per model?

Version 0, edited 6 years ago by tcbennun (next)

comment:6 follow-up: Changed 6 years ago by butler

Interestingly in versions <4.0 Guinier model did NOT include a background parameter. Since 4.0.x it does probably happened when sasmodels infrastructure took control of scale and background in order to more easily do mixture models (to prevent problems like Richard mentions of having (P(Q)+BGD) * (S(Q) + BGD) ….

However it does seem that somewhere along the line the translation to the auto generation of the docs does not pass that Background. This needs to be a new ticket.

What I don't understand however is that for this Guinier even the scale factor seems to be wrong with I(0) being or order 10-20 while other models seem to be correct. Moreover, it seems to be correct in master where the Guinier I(0) is 1 (100). I cannot see any code change that would cause that so this needs to be checked (perhaps it is a flakiness of my build system?)

Otherwise I think this is ready for a pull request though I would like to add a bit in the documentation about Rg (I like the current addition which is an excellent usage note) as it seems that a lot of our users are unclear on the concept: namely that it it quantifies the distribution from the "center of mass" of some parameter where that parameter in mechanics is mass (which can never be negative and is related to what users like to think of) but in scattering is the scattering length density (which can be negative and is not the same as mass distribution unless the object has a uniform scattering length density). Further it is only Rg2 which is defined with Rg=√Rg2, and Rg2=∑ {ρi (ri-r0)2}
Where the sum is over all points i in the object and r0 is the center of mass of the object.

comment:7 in reply to: ↑ 6 Changed 6 years ago by tcbennun

Replying to butler:

Otherwise I think this is ready for a pull request though I would like to add a bit in the documentation about Rg (I like the current addition which is an excellent usage note) as it seems that a lot of our users are unclear on the concept: namely that it it quantifies the distribution from the "center of mass" of some parameter where that parameter in mechanics is mass (which can never be negative and is related to what users like to think of) but in scattering is the scattering length density (which can be negative and is not the same as mass distribution unless the object has a uniform scattering length density). Further it is only Rg2 which is defined with Rg=√Rg2, and Rg2=∑ {ρi (ri-r0)2}
Where the sum is over all points i in the object and r0 is the center of mass of the object.

Added some detail: https://github.com/SasView/sasmodels/commit/3ba2251c4ed4e750f99d44cef1c81c91edb843a2

Will attach a screenshot of the generated doc too.

Changed 6 years ago by tcbennun

comment:8 follow-up: Changed 6 years ago by butler

Wow .. nice FAST job! …. except that I lead you astray :-( sorry about that! Forgot that Rg2 has to be normalized by ∑ρi … also it would probably be clearer if it read "SLD center of mass" (i.e. not mass center of mass) in the two places "center of mass" is used. I believe that "center of mass" is a general term that applies to any intrinsic variable like mass or SLD etc (e.g. the population center of mass?)but it is confusing when trying to distinguish between MASS center of mass and something else center of mass.

I suggest submitting a pull request from this branch. I think it is ready to go with these minor changes

comment:9 in reply to: ↑ 8 Changed 6 years ago by tcbennun

Replying to butler:

Wow .. nice FAST job! …. except that I lead you astray :-( sorry about that! Forgot that Rg2 has to be normalized by ∑ρi … also it would probably be clearer if it read "SLD center of mass" (i.e. not mass center of mass) in the two places "center of mass" is used. I believe that "center of mass" is a general term that applies to any intrinsic variable like mass or SLD etc (e.g. the population center of mass?)but it is confusing when trying to distinguish between MASS center of mass and something else center of mass.

I suggest submitting a pull request from this branch. I think it is ready to go with these minor changes

Alright, cheers! I've made those changes and submitted the pull request.

comment:10 Changed 6 years ago by butler

  • Resolution set to fixed
  • Status changed from assigned to closed

OOps … merged without closing the ticket — doing so now

comment:11 Changed 6 years ago by butler

  • Milestone changed from SasView 4.3.0 to SasView 4.2.0

was fixed for 4.2 so moving to that milestone now.

Note: See TracTickets for help on using tickets.