SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
52 stars 41 forks source link

Reporting the I(0) when fitting data. #3139

Closed marocco53 closed 1 month ago

marocco53 commented 1 month ago

This is not related to a problem. We generate SAXS data in absolute units of intensity, that is, in g/mol

When reporting all parameters in fitting data using models (e.g., a flexible cylinder), it would be nice if also the I(0) could be reported, as this will directly give the molecular weight. Otherwise, one is forced to implement in a spreadsheet the equation used, use all the fit-derived parameters, and calculate it separately. Which can become cumbersome if polydispersity is used in the fitting.

Thanks for considering this! :-)

Mattia

smk78 commented 1 month ago

To be in absolute units your intensities must have dimensions of inverse length. If you have Y-axis data in units of g/mol you are using derived units.

Some SasView models already report I(0), see the _mono_gausscoil & _poly_gausscoil, for example.

What you are asking for is already possible in SasView, you just need to rewrite or reparameterise the models you are using. As you say, I(0) is just a computation from other parameters.

Have a look at some of the examples in https://www.sasview.org/downloads/creating_custom_fitting_models_in_sasview_v5.pdf

marocco53 commented 1 month ago

Moved to https://github.com/SasView/sasview/issues/3138#issuecomment-2443770529

marocco53 commented 1 month ago

Ok, it's a matter of definition. Converting from inverse length to g/mol has some obvious advantages... ;-) My point was that in the parameters reported it would be relatively easy to have this value printed for each model, but I understand it would be a low priority for the community.

Thanks anyway - Mattia

Il 2024-10-28 13:59 Steve K ha scritto:

To be in absolute units your intensities must have dimensions of inverse length. If you have Y-axis data in units of g/mol you are using derived units.

Some SasView models already report I(0), see the _mono_gausscoil & _poly_gausscoil, for example.

What you are asking for is already possible in SasView, you just need to rewrite or reparameterise the models you are using. As you say, I(0) is just a computation from other parameters.

Have a look at some of the examples in https://www.sasview.org/downloads/creating_custom_fitting_models_in_sasview_v5.pdf

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/SasView/sasview/issues/3139#issuecomment-2441522632 [2] https://github.com/notifications/unsubscribe-auth/BMOUJQ6UQBSXGCMJU25OBVTZ5YRLJAVCNFSM6AAAAABQVWGJZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBRGUZDENRTGI

smk78 commented 1 month ago

Returning an I(0) value in inverse length is one thing. But returning an I(0) in units of g/mol requires a bunch of other information, for example bulk densities or concentrations (as opposed to volume fractions). Most models do not have these parameters.

marocco53 commented 1 month ago

Hi - sorry for the misunderstanding. We already provide I(q) in g/mol units, so all that is needed is to "print out" in the fitting parameters the I(0) of the fit... right now only the scale is produced, which it seems not directly convertible into an I(0) of the fit... So, it would be left to the user to provide I(q) in whatever units they like... ;-)

Best - Mattia

Il 2024-10-29 11:15 Steve K ha scritto:

Returning an I(0) value in inverse length is one thing. But returning an I(0) in units of g/mol requires a bunch of other information, for example bulk densities or concentrations (as opposed to volume fractions). Most models do not have these parameters.

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/SasView/sasview/issues/3139#issuecomment-2443799029 [2] https://github.com/notifications/unsubscribe-auth/BMOUJQ2ZLOXMHRVOL53DGI3Z55N23AVCNFSM6AAAAABQVWGJZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBTG44TSMBSHE

smk78 commented 1 month ago

So, you mean that when a fit completes, you would like it to evaluate I(Q) at Q=0 using the parameters that have just been optimised and the known model function, and to report that I(0) in, say, the Log Explorer? Potentially, that could be done, I guess. But it would not be a trivial amount of work. It would mean editing every model to a) compute the I(0) and b) define how I(0) is being calculated in the model documentation. If you are only using a limited number of models, it would be quicker for you to rewrite/reparameterize an exist model in terms of I(0) instead of the scale parameter. If, instead of running SasView by clicking on the icon, you open a command window, navigate to the SasView installation folder and then invoke the program by typing sasview, any output generated by the program should appear in the command window. So if you put print statements in a model they should appear. Alternatively, it is possible to run SasView from script or Jupyter notebook. Maybe one or other of these options would get you going?

marocco53 commented 1 month ago

Hi Steve, thanks for following up on this! Yes, that's exactly what I meant. I now understand the size of the problem, I naively thought that in some way the various models functions already have an I(0) calculated (since the curves do appear to go to q=0 or very close to it...).

Emre (Brookes) will attend the SAS meeting in Taiwan, if you're going, perhaps you could talk to him about this issue? I'm not keen about running programs from the command line, I'm a spoiled GUI guy... ;-) I do believe that reporting the "true" I(0) value (and not just the scale) has some value anyway, users can check if the model is consistent with other info.

Thanks again - Mattia

Il 2024-10-29 19:13 Steve K ha scritto:

So, you mean that when a fit completes, you would like it to evaluate I(Q) at Q=0 using the parameters that have just been optimised and the known model function, and to report that I(0) in, say, the Log Explorer? Potentially, that could be done, I guess. But it would not be a trivial amount of work. It would mean editing every model to a) compute the I(0) and b) define how I(0) is being calculated in the model documentation. If you are only using a limited number of models, it would be quicker for you to rewrite/reparameterize an exist model in terms of I(0) instead of the scale parameter. If, instead of running SasView by clicking on the icon, you open a command window, navigate to the SasView installation folder and then invoke the program by typing sasview, any output generated by the program should appear in the command window. So if you put print statements in a model they should appear. Alternatively, it is possible to run SasView from script or Jupyter notebook. Maybe one or other of these options would get you going?

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/SasView/sasview/issues/3139#issuecomment-2445010979 [2] https://github.com/notifications/unsubscribe-auth/BMOUJQ7MYZCLPAM2XVPOOVDZ57F55AVCNFSM6AAAAABQVWGJZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBVGAYTAOJXHE

marocco53 commented 3 weeks ago

Hello Steve,

I hope you had a pleasant meeting in Taipei, Emre told me that you had some chat with him.

Waiting for Emre and I to study some action at the level of data fitting models in SASView, I found some "disturbing results" using cylinder models. In particular, I have I(q) vs. q data on a rod-like protein sample that if I process them with the Guinier procedure, I get a Rg ~140 A, which would mean a length of ~480 A. However, when I fit these data with a cylinder model (either "regular", flexible, or ellipsoidal), I consistently get lengths around 1000 A (say twice the expected value).

Barring some mistake on my part, could this be a bug in the cylinder models in SASView 5.0.6?

I can obviously send you a typical file, if you wish. If you prefer, I can post this "officially". ;-)

Many thanks in advance for your help!

All the best - Mattia

Il 2024-10-29 19:13 Steve K ha scritto:

So, you mean that when a fit completes, you would like it to evaluate I(Q) at Q=0 using the parameters that have just been optimised and the known model function, and to report that I(0) in, say, the Log Explorer? Potentially, that could be done, I guess. But it would not be a trivial amount of work. It would mean editing every model to a) compute the I(0) and b) define how I(0) is being calculated in the model documentation. If you are only using a limited number of models, it would be quicker for you to rewrite/reparameterize an exist model in terms of I(0) instead of the scale parameter. If, instead of running SasView by clicking on the icon, you open a command window, navigate to the SasView installation folder and then invoke the program by typing sasview, any output generated by the program should appear in the command window. So if you put print statements in a model they should appear. Alternatively, it is possible to run SasView from script or Jupyter notebook. Maybe one or other of these options would get you going?

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/SasView/sasview/issues/3139#issuecomment-2445010979 [2] https://github.com/notifications/unsubscribe-auth/BMOUJQ7MYZCLPAM2XVPOOVDZ57F55AVCNFSM6AAAAABQVWGJZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBVGAYTAOJXHE

smk78 commented 1 week ago

Sorry, @marocco53 , only just seen this latest comment from you.

You are now asking about something else unrelated to this particular Github issue, which is poor practice.

Please will you email help@sasview.org with the details of what you are trying to do and what you think is wrong. Attaching a pdf/powerpoint with screenshots and the steps to reproduce (and a dataset) would be helpful.

Thanks.

marocco53 commented 1 week ago

Ok, understood, apologies. Will follow regular practice, doing some more test before risking making a fool of myself... ;-)

Thanks - Mattia

Il 2024-11-25 11:09 Steve K ha scritto:

Sorry, @marocco53 [1] , only just seen this latest comment from you.

You are now asking about something else unrelated to this particular Github issue, which is poor practice.

Please will you email @.*** with the details of what you are trying to do and what you think is wrong. Attaching a pdf/powerpoint with screenshots and the steps to reproduce (and a dataset) would be helpful.

Thanks.

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/marocco53 [2] https://github.com/SasView/sasview/issues/3139#issuecomment-2497512130 [3] https://github.com/notifications/unsubscribe-auth/BMOUJQ7CM4WBOYIFRTWMNDT2CLZOLAVCNFSM6AAAAABQVWGJZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJXGUYTEMJTGA