diff --git a/pyproject.toml b/pyproject.toml index dd523fb..c74d140 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/setup.py b/setup.py index aed36bc..516ba05 100644 --- a/setup.py +++ b/setup.py @@ -94,7 +94,11 @@ setup_args = dict( "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(), diff --git a/toasty/_libtoasty.pyx b/toasty/_libtoasty.pyx index 70e4dad..762a0aa 100644 --- a/toasty/_libtoasty.pyx +++ b/toasty/_libtoasty.pyx @@ -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 diff --git a/toasty/samplers.py b/toasty/samplers.py index b68e633..e5c7492 100644 --- a/toasty/samplers.py +++ b/toasty/samplers.py @@ -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")