Author: Timo Röhling <roehling@debian.org>
Description: NumPy 2 compatibility
Last-Update: Thu, 30 Jan 2025 09:36:02 +0100
Forwarded: no

---
 skmisc/loess/src/_loess.pyx      | 17 ++++++-----------
 skmisc/loess/tests/test_loess.py |  8 ++++----
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/skmisc/loess/src/_loess.pyx b/skmisc/loess/src/_loess.pyx
index 34c779d..7548661 100644
--- a/skmisc/loess/src/_loess.pyx
+++ b/skmisc/loess/src/_loess.pyx
@@ -76,10 +76,8 @@ cdef class loess_inputs:
         # if none was allocated prior to the error.
         self.allocated = False
 
-        x = np.array(x, copy=False, subok=True,
-                      dtype=np.float_, order='C')
-        y = np.array(y, copy=False, subok=True,
-                      dtype=np.float_, order='C')
+        x = np.asarray(x, dtype=np.float64, order='C')
+        y = np.asarray(y, dtype=np.float64, order='C')
         n = len(x)
 
         # Check the dimensions
@@ -100,13 +98,12 @@ cdef class loess_inputs:
                              "observations.")
 
         if weights is None:
-            weights = np.ones((n,), dtype=np.float_)
+            weights = np.ones((n,), dtype=np.float64)
 
         if weights.ndim > 1 or weights.size != n:
             raise ValueError("Invalid size of the 'weights' vector!")
 
-        weights = np.array(weights, copy=False, subok=True,
-                           dtype=np.float_, order='C')
+        weights = np.asarray(weights, dtype=np.float64, order='C')
 
         # Python objects -> C structures -> *data in C structures
         _x = x.ravel()
@@ -417,8 +414,7 @@ cdef class loess_model:
                 "of booleans with length equal to the number "
                 "of independent variables")
 
-        p_ndr = np.atleast_1d(np.array(value, copy=False, subok=True,
-                                       dtype=bool))
+        p_ndr = np.atleast_1d(np.asarray(value, dtype=bool))
         for i in range(self.p):
             self._base.parametric[i] = p_ndr[i]
 
@@ -438,8 +434,7 @@ cdef class loess_model:
                 "of booleans with length equal to the number "
                 "of independent variables")
 
-        d_ndr = np.atleast_1d(np.array(value, copy=False,
-                                       subok=True, dtype=bool))
+        d_ndr = np.atleast_1d(np.asarray(value, dtype=bool))
         for i in range(self.p):
             self._base.drop_square[i] = d_ndr[i]
 
diff --git a/skmisc/loess/tests/test_loess.py b/skmisc/loess/tests/test_loess.py
index e8fa175..00926bb 100644
--- a/skmisc/loess/tests/test_loess.py
+++ b/skmisc/loess/tests/test_loess.py
@@ -19,11 +19,11 @@ def madeup_data():
         f.readline()
         x = np.fromiter(
             (float(v) for v in f.readline().rstrip().split()),
-            np.float_).reshape(-1, 2)
+            np.float64).reshape(-1, 2)
         f.readline()
         y = np.fromiter(
             (float(v) for v in f.readline().rstrip().split()),
-            np.float_)
+            np.float64)
 
     results = []
     with open(rfile, 'r') as f:
@@ -31,7 +31,7 @@ def madeup_data():
             f.readline()
             z = np.fromiter(
                 (float(v) for v in f.readline().rstrip().split()),
-                np.float_)
+                np.float64)
             results.append(z)
 
     newdata1 = np.array([[-2.5, 0.], [2.5, 0.], [0., 0.]])
@@ -58,7 +58,7 @@ def gas_data():
             f.readline()
             z = np.fromiter(
                 (float(v) for v in f.readline().rstrip().split()),
-                np.float_)
+                np.float64)
             results.append(z)
     return (E, NOx, gas_fit_E, newdata, alpha, results)
 
