From 9b688df5ce4e507ec82cccf33709062549a28339 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 12 Jun 2024 22:21:02 +0200 Subject: [PATCH 1/5] Update for 3.12 --- deerlab/diststats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deerlab/diststats.py b/deerlab/diststats.py index 9368de5b..3497e7b5 100644 --- a/deerlab/diststats.py +++ b/deerlab/diststats.py @@ -7,7 +7,7 @@ import warnings import copy from scipy.signal import find_peaks -from scipy.integrate import cumtrapz +from scipy.integrate import cumulative_trapezoid as cumtrapz def diststats(r, P, Puq=None, verbose=False, threshold=None): r""" From 2632f5a33cf1058be2508aa159566fd5eb767e8d Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 12 Jun 2024 22:29:00 +0200 Subject: [PATCH 2/5] Updated workflows and changelog --- .github/workflows/ci_PR.yml | 2 +- .github/workflows/ci_scheduled.yml | 2 +- docsrc/source/changelog.rst | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_PR.yml b/.github/workflows/ci_PR.yml index 63de2eec..88374ad6 100644 --- a/.github/workflows/ci_PR.yml +++ b/.github/workflows/ci_PR.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.10','3.11'] + python-version: ['3.11','3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/ci_scheduled.yml b/.github/workflows/ci_scheduled.yml index 0659c65f..b101659c 100644 --- a/.github/workflows/ci_scheduled.yml +++ b/.github/workflows/ci_scheduled.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: [3.8, 3.9, "3.10", "3.11", "3.12","3.12"] steps: - uses: actions/checkout@v3 diff --git a/docsrc/source/changelog.rst b/docsrc/source/changelog.rst index 3aa92232..d8edd8c8 100644 --- a/docsrc/source/changelog.rst +++ b/docsrc/source/changelog.rst @@ -28,6 +28,7 @@ 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 Release ``v1.1.2`` - November 2023 ------------------------------------------ From 3d1cc8623fc1aeddfddb12281ee03aa92ff426d1 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Wed, 12 Jun 2024 22:29:49 +0200 Subject: [PATCH 3/5] Upload to 3.12 --- .github/workflows/package_upload.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package_upload.yml b/.github/workflows/package_upload.yml index 69be3f25..4a3b9977 100644 --- a/.github/workflows/package_upload.yml +++ b/.github/workflows/package_upload.yml @@ -11,10 +11,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" + python-version: "3.11" - name: Install pypa/build run: >- python -m pip install build --user From d07d3cb3e10edad9ac5e1602dbda013b2f6ccb78 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Mon, 1 Jul 2024 17:20:44 +0200 Subject: [PATCH 4/5] Numpy 2.0 compatibility updates --- deerlab/classes.py | 2 +- deerlab/dd_models.py | 2 +- deerlab/diststats.py | 2 +- test/test_dipolarkernel.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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/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 From dd3ed266ffc62e4e6552105b807686f6f515b1c3 Mon Sep 17 00:00:00 2001 From: Hugo Karas Date: Mon, 1 Jul 2024 17:23:37 +0200 Subject: [PATCH 5/5] Update Changelog --- docsrc/source/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docsrc/source/changelog.rst b/docsrc/source/changelog.rst index d8edd8c8..3787cb90 100644 --- a/docsrc/source/changelog.rst +++ b/docsrc/source/changelog.rst @@ -28,7 +28,8 @@ 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 ------------------------------------------