From 62c28e6bb5f965ee09be5a0d6d522ce54a42700c Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Tue, 17 Feb 2026 22:52:41 +0000 Subject: [PATCH 1/2] Add conditional import for trapz based on NumPy version Import trapz function conditionally based on NumPy version. --- calphy/integrators.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/calphy/integrators.py b/calphy/integrators.py index e51e722..e5a0700 100644 --- a/calphy/integrators.py +++ b/calphy/integrators.py @@ -40,6 +40,13 @@ from scipy.integrate import cumtrapz except ImportError: from scipy.integrate import cumulative_trapezoid as cumtrapz + +npversion = int(np.__version__.split('.')[0]) +if npversion <= 1: + from numpy import trapz +else: + from numpy import trapezoid as trapz + from tqdm import tqdm import pyscal3.core as pc from ase.io import read From b596c053bd5f028f3070797472cc1ecc1bf81c28 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Tue, 17 Feb 2026 22:56:24 +0000 Subject: [PATCH 2/2] Actually change trapz callsites --- calphy/integrators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calphy/integrators.py b/calphy/integrators.py index e5a0700..5649c85 100644 --- a/calphy/integrators.py +++ b/calphy/integrators.py @@ -129,8 +129,8 @@ def integrate_path( fdu = fdui - fdur bdu = bdui - bdur - fw = np.trapz(fdu, flambda) - bw = np.trapz(bdu, blambda) + fw = trapz(fdu, flambda) + bw = trapz(bdu, blambda) w = 0.5 * (fw - bw) q = 0.5 * (fw + bw)