Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer overflow in maps.HealpixSkyMap.angle_to_pixel for nside = 16384 #119

Closed
ndhuang opened this issue Sep 8, 2023 · 1 comment · Fixed by #120
Closed

Integer overflow in maps.HealpixSkyMap.angle_to_pixel for nside = 16384 #119

ndhuang opened this issue Sep 8, 2023 · 1 comment · Fixed by #120
Assignees
Labels

Comments

@ndhuang
Copy link
Collaborator

ndhuang commented Sep 8, 2023

m = maps.HealpixSkyMap(16384)
m.angle_to_pixel(0, -pi / 2)
>>> 18446744073709551615
@arahlin arahlin self-assigned this Sep 8, 2023
@arahlin arahlin added the bug label Sep 8, 2023
@arahlin
Copy link
Member

arahlin commented Sep 8, 2023

This issue stems from using int32 for all of the math. There are int64 versions of all the chealpix functions, but HealpixSkyMapInfo class probably needs some TLC to make sure that all of the internal functions there are using int64 as well.

arahlin added a commit that referenced this issue Sep 8, 2023
arahlin added a commit that referenced this issue Sep 26, 2023
This PR ensures that maps are consistently indexed using 64-bit integers everywhere, to avoid truncation e.g. when indexing maps with high nside (>8192).  The healpix C bindings are moved out of the public API, and the header is modified to use the `ssize_t` integer type for all 64-bit functions.

Fixes #119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants