Skip to content

Commit

Permalink
Merge pull request #102 from pkgw/numpy-2
Browse files Browse the repository at this point in the history
Update for Numpy 2.0 compatibility
  • Loading branch information
pkgw authored Jul 21, 2024
2 parents d2d57c0 + a61c814 commit 6b5c0c2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ci/azure-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ parameters:
PYTHON_SERIES: "3.9"

- name: macos_310
vmImage: macos-11
vmImage: macos-12
vars:
PYTHON_SERIES: "3.10"

- name: macos_39
vmImage: macos-11
vmImage: macos-12
vars:
PYTHON_SERIES: "3.9"

Expand Down
12 changes: 2 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
[build-system]
requires = [
'cython',
'oldest-supported-numpy',
'setuptools',
'wheel',
]
requires = ['cython', 'numpy', 'setuptools', 'wheel']
build-backend = 'setuptools.build_meta'

[tool.cranko]
annotated_files = [
"docs/conf.py",
"toasty/cli.py",
]
annotated_files = ["docs/conf.py", "toasty/cli.py"]
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def get_long_desc():
"build_ext": build_ext,
},
ext_modules=[
Extension("toasty._libtoasty", ["toasty/_libtoasty.pyx"]),
Extension(
"toasty._libtoasty",
["toasty/_libtoasty.pyx"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
),
],
include_dirs=[
np.get_include(),
Expand Down
4 changes: 3 additions & 1 deletion toasty/_libtoasty.pyx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from libc.math cimport sin, cos, atan2, hypot
import numpy as np

cimport cython

cimport numpy as np
import numpy as np

np.import_array()

DTYPE = np.float64
ctypedef np.float64_t DTYPE_t
Expand Down
3 changes: 2 additions & 1 deletion toasty/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def healpix_fits_file_sampler(
# needed.
data = data[data.dtype.names[0]]
if data.dtype.byteorder not in "=|":
data = data.byteswap().newbyteorder()
data = data.byteswap()
data = data.view(data.dtype.newbyteorder())

nest = hdr.get("ORDERING") == "NESTED"
coord = hdr.get("COORDSYS", "C")
Expand Down

0 comments on commit 6b5c0c2

Please sign in to comment.