-
Notifications
You must be signed in to change notification settings - Fork 30
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
Consider implementing metalog size distributions #585
Comments
I think the quantile approach will be good for 1D polydispersity, but it gets weird, complicated or both when it comes to multiple dimensions. |
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 |
To compare the different integration strategies over a size distribution it might be useful to test against an analytical solution available. I could imagine that instead of a Gaussian distribution a gamma distribution of sphere might be useful in this case. I found a paper from Andre Heineman (https://doi.org/10.1107/S0021889800013248) who supplied an analytical expression for core shell particles with a gamma size distribution, whereas the gamma size distribution was parametrized in terms of a mean radius As far as I understand, the SASview internal integration routine make use of algorithm on a fixed grid, like Gauss-Legendre or Gauss-Lobatto. Both algorithms rely on well-chosen grid points which are in the case of these two strategies related to the roots of Legendre polynomials. The boundaries of the integration interval are chosen manual via the GUI by Instead of clipping the semi-infinite interval In the past I thought this would be the solution for calculating size smeared form factors. However, test have shown that for broad distribution the transformation works well, but for very narrow distributions the integrand is zero almost everywhere in the interval (0;1] except in a very tiny range, which is typically difficult to catch with a low number of grid points. Therefore, I initially went back to the clipping strategy of the integration interval. As it was mentioned already one needs to take care, that due to the What the above-mentioned distributions additionally have in common is that there is an analytical available expression for their quantile distribution function Especially when mainly using adaptive integration routines to have control over the relative and absolute error of the size smearing, performance comparison tests with fixed grid algorithms need more caution. Coming back to the initial suggested model for testing and comparing the different strategies, the above-mentioned case might be useful as the formula given by Andre Heinemann are analytical and can be calculated to arbitrary precision. |
You mentioned you "played with integration using equally spaced quantile steps". Actually, what I suggested was not to use the quantile distribution function for the generation of a grid. I suggested a full change of variables for the size distribution integral. Instead of integrating over the size parameter |
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.
The text was updated successfully, but these errors were encountered: