From 4b309a645c1dcc4cf731ef61e2549301d003e5fe Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Thu, 4 Jul 2024 21:24:36 +0200 Subject: [PATCH] Make uncertainties compatible with numpy 2.0 (#245) use `dot` and `isscalar` from `numpy` instead of older `numeric` in `unumpy.core` to work with Numpy 2.0 --- uncertainties/unumpy/core.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/uncertainties/unumpy/core.py b/uncertainties/unumpy/core.py index 54addf06..861339fc 100644 --- a/uncertainties/unumpy/core.py +++ b/uncertainties/unumpy/core.py @@ -20,7 +20,6 @@ # 3rd-party modules: import numpy -from numpy.core import numeric # Local modules: import uncertainties.umath_core as umath_core @@ -585,10 +584,10 @@ def __rmul__(self, other): # scalar and of a matrix containing objects (when the # arguments are given in this order). We go around this # limitation: - if numeric.isscalar(other): - return numeric.dot(self, other) + if numpy.isscalar(other): + return numpy.dot(self, other) else: - return numeric.dot(other, self) # The order is important + return numpy.dot(other, self) # The order is important def getI(self): """Matrix inverse or pseudo-inverse."""