diff --git a/caput/truncate.pyx b/caput/truncate.pyx index ea40e30c..ed38215b 100644 --- a/caput/truncate.pyx +++ b/caput/truncate.pyx @@ -8,6 +8,9 @@ from cython.parallel import prange import numpy as np cimport numpy as cnp +# Required for numpy 2.0 compatibility +np.import_array() + cdef extern from "truncate.hpp": inline int bit_truncate(int val, int err) nogil diff --git a/caput/weighted_median.pyx b/caput/weighted_median.pyx index 95be780c..0d3fca6e 100644 --- a/caput/weighted_median.pyx +++ b/caput/weighted_median.pyx @@ -12,6 +12,9 @@ from MedianTree cimport Tree, Data cimport numpy as np cimport cython +# Required for numpy 2.0 compatibility +np.import_array() + # Define the fused types that can be used for the data or weights in the median routine ctypedef fused data_t: int