Adding ImageD11.transform.Ctransform.sf2gvlocal for fast s3dxrd local gve computation #556
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.
This PR represents a fully backwards compatible upgrade that goes towards heavily speeding up
ImageD11.sinograms.point_by_point.compute_gvewhich is a core call in various s3DXRD point-by-point mapping algorithms. The new implementation offers a 2 x - 8 x speedup across data-set sizes.What is added:
ImageD11.transform.Ctransformnamedsf2gvlocalwhich represents a local variation of the existing class member functionsf2gv.sf2gvlocalacceptsxpos, per peak diffraction origins along a pencil-beam. This makes it fully equivalent toImageD11.sinograms.point_by_point.compute_gve.sf2gvlocalto be compile-speed. This backend lives in cImageD11 and is simply a functioncompute_xlylzl_xpos_variableexactly likecompute_xlylzlbut with the extension to diffraction origins.Benefits:
Some simple tests. We start by defining some wrappers for the functions we want to compare:
Some single thread benchmarks on a large (real) dataset:
Output:
The speedup is clear. The functions produce the same output 👍
A deeper benchmark across variable data-set sizes:
This gives us the following profile:

The plotting code that was used:
Outlook
Now one may replace
ImageD11.sinograms.point_by_point.compute_gvewith a call toImageD11.transform.Ctransform.sf2gvlocal🙂Apologies
I apologise if any code formatting changed uneccessarily due to on save auto-Ruff formating (black).