Adding a pure python truncated octahedron model with Fibonacci orientation averaging #738
Merged
Merged
Conversation
added 4 commits
June 2, 2026 12:27
8 tasks
| using the Fibonacci quadrature. This quadrature provides a quasi-uniform distribution of points on the unit sphere | ||
| using the golden ratio. The only new parameter is the number of points to generate on the unit sphere. | ||
| The default value (around 400 points) provides a good balance between accuracy and computational efficiency. | ||
| It contains both the form factor for a reference orientation and the 1D form factor after orientation average (Gauss-Legendre). |
Contributor
There was a problem hiding this comment.
Since it's using the fibonacci quadrature, shouldn't we keep the fibonacci description in the documentation instead of Gauss-Legendre ?
states at the beginning that this is a pure python version using Fibonacci integration.
marimperorclerc
approved these changes
Jun 3, 2026
marimperorclerc
left a comment
Contributor
There was a problem hiding this comment.
This version (pure python plus FIbonacci integration) is useful for comparision purposes with the truncated_octahedron model which is based on .c and .py with adaptive Gauss-Legendre integration.
Here (truncated_octahedron_fibonacci) all analytical expressions are coded in python (no .c file).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adding a pure python model for truncated octahedrons with orientation averaging using Fibonacci quadrature.
Fixes #686
Replaces #694
How Has This Been Tested?
Unit tests worked.
This model was compared with the model using C code (octahedron_truncated.c) and shows good agreement.
In general, the octahedron model was compared to an another numerical calculation : for truncated octahedrons with different sizes and truncatures, agreement was found with the Debye equation (Debye calculator: https://github.com/FrederikLizakJohansen/DebyeCalculator). The Debye equation is based on atomic positions while SasView model is based on analytical expressions.
More tests should be made on small q. Indeed, like the previous model (octahedron_truncated.c), we encouter issues when it comes to small q (q<10^-6 Angs). More precise mathematical should be used (hospital rule, etc).
Note : the fibonacci quadrature code (sasmodels/quadratures/fibonacci.py) was added to a new repository called "quadratures" because it could be also useful for other models.
Compare with gauss-legendre grid using:
Parameters set on the command line (e.g.
radius_a=1000) will be shared between the two models.Adjust the number of fibonacci points using
npoints_fibonacci=n. Adjust the number of gaussian quadrature points using-ngauss=n(where n is zero for adaptive integration).Review Checklist:
[if using the editor, use
[x]in place of[ ]to check a box]Documentation (check at least one)
Installers
Licensing (untick if necessary)