Numpy2 implementation and updates on testing#527
Merged
JulienDoerner merged 59 commits intoCRPropa:masterfrom Feb 16, 2026
Merged
Numpy2 implementation and updates on testing#527JulienDoerner merged 59 commits intoCRPropa:masterfrom
JulienDoerner merged 59 commits intoCRPropa:masterfrom
Conversation
This was
linked to
issues
Jul 23, 2025
JanNiklasB
suggested changes
Oct 13, 2025
Contributor
JanNiklasB
left a comment
There was a problem hiding this comment.
Hey,
you include python headers inside Vector3.h without any protection when python headers could not be found (see comments), those would fail to compile if the headers do not exist or are not included when ENABLE_PYTHON=OFF.
Other then that it looks good.
lukasmerten
approved these changes
Feb 12, 2026
JanNiklasB
approved these changes
Feb 13, 2026
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.
In this PR the
numpyinterface is adapted to account for the changes introduced with the change to version 2.The Vector3 class can now be used as a numpy array.
The second issue with numpy >= 2.0 is the compatibility with the Lens interface. This can not easily be adapted. Therefore, I set the default installation behavior to off and add a warning when compiling CRPropa using the lenses with numpy 2.
In this PR I also address the issues in the testing.
The Ubuntu20 test (#526) is removed and replaced by a test for Ubuntu24. This test is now run on an x86 and an arm architecture.
The MacOS test (#515) has been adapted to the recommended installation by setting all needed flags/pathes directly. This might become a problem in the future when the MacOS runner is updated with newer versions, but this is only a small issue.
In the MacOS test there was also an issue with the EMPairProduction, where sometimes the sampling of the center of mass energy was sampled within the first bin and therefore it used non-valid elements in the tabulated values.