Skip to content

Numpy2 implementation and updates on testing#527

Merged
JulienDoerner merged 59 commits intoCRPropa:masterfrom
JulienDoerner:numpy2
Feb 16, 2026
Merged

Numpy2 implementation and updates on testing#527
JulienDoerner merged 59 commits intoCRPropa:masterfrom
JulienDoerner:numpy2

Conversation

@JulienDoerner
Copy link
Copy Markdown
Member

In this PR the numpy interface 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.

This was linked to issues Jul 23, 2025
Copy link
Copy Markdown
Contributor

@JanNiklasB JanNiklasB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JulienDoerner JulienDoerner merged commit 167fbd0 into CRPropa:master Feb 16, 2026
6 of 7 checks passed
@JulienDoerner JulienDoerner deleted the numpy2 branch February 16, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ubuntu-20 workflows needs to be replaced MacOS runner not working

3 participants