Skip to content

Commit

Permalink
Merge pull request #215 from neutrinoceros/numpy2_compat
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog authored Apr 5, 2024
2 parents 1bed556 + 6d68e8d commit 6cdea5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions astropy_healpix/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'neighbours',
]

_NUMPY_COPY_IF_NEEDED = False if np.__version__.startswith("1.") else None


def _validate_order(order):
# We also support upper-case, to support directly the values
Expand Down Expand Up @@ -369,8 +371,8 @@ def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):

lon, lat = func(healpix_index, nside, dx, dy)

lon = Longitude(lon, unit=u.rad, copy=False)
lat = Latitude(lat, unit=u.rad, copy=False)
lon = Longitude(lon, unit=u.rad, copy=_NUMPY_COPY_IF_NEEDED)
lat = Latitude(lat, unit=u.rad, copy=_NUMPY_COPY_IF_NEEDED)

return lon, lat

Expand Down

0 comments on commit 6cdea5e

Please sign in to comment.