From f49e6dab313b3fdd89acdef0201c6c2de8e0c654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schm=C3=B6lder?= Date: Sat, 2 Mar 2024 13:19:29 +0100 Subject: [PATCH] Avoid numpy/scipy deprecation warnings --- CADETProcess/comparison/difference.py | 6 +++--- CADETProcess/dataStructure/parameter.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CADETProcess/comparison/difference.py b/CADETProcess/comparison/difference.py index 0a4089a13..3917585e4 100644 --- a/CADETProcess/comparison/difference.py +++ b/CADETProcess/comparison/difference.py @@ -4,7 +4,7 @@ from warnings import warn import numpy as np -from scipy.integrate import simps +from scipy.integrate import simpson from scipy.special import expit from CADETProcess import CADETProcessError @@ -427,10 +427,10 @@ def _evaluate(self, solution): Concentration profile of simulation. """ - area_ref = simps( + area_ref = simpson( self.reference.solution, self.reference.time, axis=0 ) - area_new = simps(solution.solution, solution.time, axis=0) + area_new = simpson(solution.solution, solution.time, axis=0) return abs(area_ref - area_new)/area_ref diff --git a/CADETProcess/dataStructure/parameter.py b/CADETProcess/dataStructure/parameter.py index beb626979..b5b5d4cb4 100644 --- a/CADETProcess/dataStructure/parameter.py +++ b/CADETProcess/dataStructure/parameter.py @@ -1529,7 +1529,7 @@ def fill_values(self, dims, value): raise ValueError("Can only set single entry if n_entries == 1.") if isinstance(value, np.ndarray) and value.size == 1: - value = float(value) + value = float(value.squeeze()) if isinstance(value, (int, float)): value = n_entries * [value]