Skip to content

Commit 224d8ca

Browse files
authored
Merge pull request python-quantities#227 from zm711/numpy-updates
Switch `np` aliases which will be removed in NumPy 2.0
2 parents 455190f + 6b745f4 commit 224d8ca

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

quantities/quantity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ def clip(self, min=None, max=None, out=None):
604604
if min is None and max is None:
605605
raise ValueError("at least one of min or max must be set")
606606
else:
607-
if min is None: min = Quantity(-np.Inf, self._dimensionality)
608-
if max is None: max = Quantity(np.Inf, self._dimensionality)
607+
if min is None: min = Quantity(-np.inf, self._dimensionality)
608+
if max is None: max = Quantity(np.inf, self._dimensionality)
609609

610610
if self.dimensionality and not \
611611
(isinstance(min, Quantity) and isinstance(max, Quantity)):

quantities/tests/test_umath.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_sum(self):
1717
self.assertQuantityEqual(np.sum(self.q), 10 * pq.J)
1818

1919
def test_nansum(self):
20-
c = [1,2,3, np.NaN] * pq.m
20+
c = [1,2,3, np.nan] * pq.m
2121
self.assertQuantityEqual(np.nansum(c), 6 * pq.m)
2222

2323
def test_cumprod(self):
@@ -114,19 +114,19 @@ def test_around(self):
114114
[0, 0, 0, 10] * pq.J
115115
)
116116

117-
def test_round_(self):
117+
def test_round(self):
118118
self.assertQuantityEqual(
119-
np.round_([.5, 1.5, 2.5, 3.5, 4.5] * pq.J),
119+
np.round([.5, 1.5, 2.5, 3.5, 4.5] * pq.J),
120120
[0., 2., 2., 4., 4.] * pq.J
121121
)
122122

123123
self.assertQuantityEqual(
124-
np.round_([1,2,3,11] * pq.J, decimals=1),
124+
np.round([1,2,3,11] * pq.J, decimals=1),
125125
[1, 2, 3, 11] * pq.J
126126
)
127127

128128
self.assertQuantityEqual(
129-
np.round_([1,2,3,11] * pq.J, decimals=-1),
129+
np.round([1,2,3,11] * pq.J, decimals=-1),
130130
[0, 0, 0, 10] * pq.J
131131
)
132132

0 commit comments

Comments
 (0)