diff --git a/deerlab/classes.py b/deerlab/classes.py index 7e9b3e14..39063cbf 100644 --- a/deerlab/classes.py +++ b/deerlab/classes.py @@ -381,7 +381,7 @@ def percentile(self,p): cdf = np.cumsum(pdf) cdf /= max(cdf) # Eliminate duplicates - cdf, index = np.lib.arraysetops.unique(cdf,return_index=True) + cdf, index = np.unique(cdf,return_index=True) # Interpolate requested percentile x[n] = np.interp(p/100,cdf,values[index]) diff --git a/deerlab/dd_models.py b/deerlab/dd_models.py index dc32cbaa..1c4d6d3f 100644 --- a/deerlab/dd_models.py +++ b/deerlab/dd_models.py @@ -110,7 +110,7 @@ def _multigaussfun(r,r0,sig): P = np.sqrt(1/(2*np.pi))*1/sig*np.exp(-0.5*((r.T-r0)/sig)**2) if not np.all(P==0): # Normalization - P = np.squeeze(P)/np.sum([np.trapz(c,r) for c in P.T]) + P = np.squeeze(P)/np.sum([np.trapezoid(c,r) for c in P.T]) else: P = np.squeeze(P) return P diff --git a/deerlab/diststats.py b/deerlab/diststats.py index 3497e7b5..22d5d022 100644 --- a/deerlab/diststats.py +++ b/deerlab/diststats.py @@ -109,7 +109,7 @@ def normalize(P): # Percentile function def pctile(r,P,p): cdf = cumtrapz(normalize(P),r,initial=0) - cdf, index = np.lib.arraysetops.unique(cdf,return_index=True) + cdf, index = np.unique(cdf,return_index=True) rpctile = np.interp(p/100,cdf,r[index]) return rpctile # Expectation operator function diff --git a/docsrc/source/changelog.rst b/docsrc/source/changelog.rst index d8edd8c8..c1aa84ca 100644 --- a/docsrc/source/changelog.rst +++ b/docsrc/source/changelog.rst @@ -28,7 +28,9 @@ Release ``v1.1.3`` - Ongoing ------------------------------------------ - |fix| : Removes unnecessary files from the docs - |efficiency| : Improves the performance of the ``dipolarkernel`` function by 10-30% (:pr:`473`), by caching the interpolation of he effective dipolar evolution time vector. -- |fix| : add support for Python 3.12 +- |fix| : Add support for Python 3.12 +- |fix| : Adds support for Numpy 2.0 + Release ``v1.1.2`` - November 2023 ------------------------------------------ diff --git a/test/test_dipolarkernel.py b/test/test_dipolarkernel.py index 8f7c505a..2d198541 100644 --- a/test/test_dipolarkernel.py +++ b/test/test_dipolarkernel.py @@ -1,6 +1,6 @@ import numpy as np -from numpy import pi, inf, NaN +from numpy import pi, inf from deerlab.bg_models import bg_hom3d,bg_exp from deerlab.dd_models import dd_gauss from deerlab.dipolarkernel import dipolarkernel,elementarykernel_twospin