From d44aaedeba2619b54d3697be1691944582afda54 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Tue, 2 Jul 2024 17:08:11 +0100 Subject: [PATCH] Update deprecated scipy.integrate simps -> simpson --- CHANGELOG.rst | 1 + tests_and_analysis/test/euphonic_test/test_broadening.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9f33c724e..9385fa6d7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,6 +25,7 @@ - Compatibility fix for Numpy 2.0 update: avoid some broadcasting issues with array shape returned by ``np.unique`` + - Update reference to scipy.integrate.simpson ------------------------------------------------------------------------------- diff --git a/tests_and_analysis/test/euphonic_test/test_broadening.py b/tests_and_analysis/test/euphonic_test/test_broadening.py index bc5ddd838..24eb153f9 100644 --- a/tests_and_analysis/test/euphonic_test/test_broadening.py +++ b/tests_and_analysis/test/euphonic_test/test_broadening.py @@ -3,7 +3,7 @@ from numpy.polynomial import Polynomial from numpy.random import RandomState import numpy.testing as npt -from scipy.integrate import simps +from scipy.integrate import simpson from scipy.ndimage import gaussian_filter from euphonic.broadening import (find_coeffs, @@ -74,10 +74,10 @@ def test_area_unchanged_for_broadened_dos(material, qpt_freqs_json, fit='cheby-log') ebins_centres = ebins.magnitude[:-1] + 0.5*np.diff(ebins.magnitude) assert dos.y_data.units == 1/ebins.units - dos_area = simps(dos.y_data.magnitude, ebins_centres) + dos_area = simpson(dos.y_data.magnitude, x=ebins_centres) assert variable_width_broaden.units == 1/ebins.units - adaptively_broadened_dos_area = simps(variable_width_broaden.magnitude, - ebins_centres) + adaptively_broadened_dos_area = simpson( + variable_width_broaden.magnitude, x=ebins_centres) assert adaptively_broadened_dos_area == pytest.approx(dos_area, rel=0.01)