Closed svank closed 1 month ago
Thank you so much for just jumping in and fixing this, it's been on my list for ages.
Will review later today.
pre-commit.ci autofix
SUMMON BACKPORT BOT
@MeeseeksDev backport to 2.2
Owee, I'm MrMeeseeks, Look at me.
There seem to be a conflict, please backport manually. Here are approximate instructions:
git checkout 2.2
git pull
Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 84f6f624855d68c634e14565807040f2f8cb100c
You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #767: Only compute needed dims in _generate_world_coords'
git push YOURFORK 2.2:auto-backport-of-pr-767-on-2.2
"Backport PR #767 on branch 2.2 (Only compute needed dims in _generate_world_coords)"
And apply the correct labels and milestones.
Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!
Remember to remove the Still Needs Manual Backport
label once the PR gets merged.
If these instructions are inaccurate, feel free to suggest an improvement.
@Cadair pointed me to
axis_world_coords
for verifying the order of the polarization axis in a DKIST/ViSP data set (which is anNDCube
). It works, but for a dataset of shape(4, 2, 1100, 915, 2555)
(polarization, repetition, scan step, wavelength, spatial), it computes a lot of world coordinates in 30 s (since rep, scan step and spatial are correlated), just to return the four Stokes coordinates. I dug in and took a shot at implementing the TODO, to have the underlying_generate_world_coords
only runpixel_to_world
for the axes that are being requested, offering a huge speedup in cases like this.I rearranged
axis_world_coords
andaxis_world_coords_values
to first determine which world coordinate axes will be needed, and then pass those indices into_generate_world_coords
, which skips processing any pixel dimension that doesn't contribute to those world dimensions.Does this warrant a new test? I think that would look like verifying that
_generate_world_coords
returns just the throwaway value for unneeded axes.My use case is
The last line takes 3.23 ms with this PR, and 34.8 s without.
Fixes #554