SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
16 stars 28 forks source link

Consider implementing metalog size distributions #585

Open smk78 opened 1 year ago

smk78 commented 1 year ago

Following discussions at CanSAS-2023, @kohlbrecher suggests SasView follow the lead of SASfit and implement its size distributions in terms of a Metalog Distribution:

https://en.wikipedia.org/wiki/Metalog_distribution https://doi.org/10.1107/S1600576722009037, Section 5.1 & Fig 4

This very flexible distribution could overcome the limitations imposed on fit solutions by the shapes of singular (or composites of singular) distributions.

The Metalog Distribution is defined through its Quantile Probability Distribution (the inverse of the Cumulative Distribution Function).

Many 'conventional' distribution functions also have analytic quantile functions, for example:

https://en.wikipedia.org/wiki/Quantile_function#Simple_example https://en.wikipedia.org/wiki/Log-normal_distribution, under 'Mode, Median, Quantiles'

It is also possible that the QPD approach could be more numerically stable because it is a proper integral (over 0 - 1) unlike the improper integrals (over 0 - inf) of traditional size distributions.

lucas-wilkins commented 1 year ago

I think the quantile approach will be good for 1D polydispersity, but it gets weird, complicated or both when it comes to multiple dimensions.

Kohlbrecher commented 1 year ago

I am not sure why you think it gets more complicated using multiple parameters with a distribution. The parameter having a distribution is simply replaced by its QDF. If you have multiple independent parameters each will be replaced by a separate QDF and the multiple integral has to be calculated over a hypercube [0,1]^n