From ec8af3d9090bb6d4e152be8230e9a5d3c03e79d5 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 25 Jun 2024 14:09:34 +0200 Subject: [PATCH] replace deprecated np.NINF with -np.inf --- src/simsopt/_core/optimizable.py | 4 ++-- tests/core/test_dofs.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/simsopt/_core/optimizable.py b/src/simsopt/_core/optimizable.py index e95228b1d..58a3d6ba7 100644 --- a/src/simsopt/_core/optimizable.py +++ b/src/simsopt/_core/optimizable.py @@ -87,7 +87,7 @@ def __init__(self, free: Array of boolean values denoting if the DOFs is are free. False values implies the corresponding DOFs are fixed lower_bounds: Lower bounds for the DOFs. Meaningful only if - DOF is not fixed. Default is np.NINF + DOF is not fixed. Default is -np.inf upper_bounds: Upper bounds for the DOFs. Meaningful only if DOF is not fixed. Default is np.inf """ @@ -106,7 +106,7 @@ def __init__(self, free = np.asarray(free, dtype=np.bool_) if lower_bounds is None: - lower_bounds = np.full(len(x), np.NINF) + lower_bounds = np.full(len(x), -np.inf) else: lower_bounds = np.asarray(lower_bounds, np.double) diff --git a/tests/core/test_dofs.py b/tests/core/test_dofs.py index 1c6c00c4a..452f7ffe7 100755 --- a/tests/core/test_dofs.py +++ b/tests/core/test_dofs.py @@ -168,7 +168,7 @@ def test_lower_bounds(self): names=np.array(['x', 'y', 'z']), free=np.array([True, True, False])) self.assertTrue(np.allclose(dofs.free_lower_bounds, - np.array([np.NINF, np.NINF]))) + np.array([-np.inf, -np.inf]))) with self.assertRaises(DofLengthMismatchError): dofs.free_lower_bounds = np.array([-1000.0, -1001.0, -1002.0]) @@ -180,7 +180,7 @@ def test_lower_bounds(self): dofs.unfix_all() self.assertTrue(np.allclose(dofs.free_lower_bounds, - np.array([-1000.0, -1001.0, np.NINF]))) + np.array([-1000.0, -1001.0, -np.inf]))) dofs.free_lower_bounds = np.array([-1000.0, -1001.0, -1002.]) self.assertTrue(np.allclose(dofs.free_lower_bounds,