From 5e6d3b5ca2a4653f8f20f55bee489b4e8ba9da5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Tronsgaard?= Date: Thu, 29 Jun 2023 13:02:38 +0100 Subject: [PATCH] warnings library must be imported directly numpy.warnings no longer available since version 1.24.0 --- pyreduce/util.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyreduce/util.py b/pyreduce/util.py index ec2944ab..fb9ab4e8 100644 --- a/pyreduce/util.py +++ b/pyreduce/util.py @@ -5,6 +5,7 @@ import logging import os +import warnings from itertools import product import matplotlib.pyplot as plt @@ -317,8 +318,8 @@ def gaussfit2(x, y): i = np.argmax(y * weights) p0 = [y[i], x[i], 1] - with np.warnings.catch_warnings(): - np.warnings.simplefilter("ignore") + with warnings.catch_warnings(): + warnings.simplefilter("ignore") res = least_squares( lambda c: gauss(x, *c, np.ma.min(y)) - y, p0, @@ -355,8 +356,8 @@ def gaussfit3(x, y): i = np.argmax(y[len(y) // 4 : len(y) * 3 // 4]) + len(y) // 4 p0 = [y[i], x[i], 1, np.min(y)] - with np.warnings.catch_warnings(): - np.warnings.simplefilter("ignore") + with warnings.catch_warnings(): + warnings.simplefilter("ignore") popt, _ = curve_fit(gauss, x, y, p0=p0) return popt @@ -386,8 +387,8 @@ def gaussfit4(x, y): i = np.argmax(y) p0 = [y[i], x[i], 1, np.min(y)] - with np.warnings.catch_warnings(): - np.warnings.simplefilter("ignore") + with warnings.catch_warnings(): + warnings.simplefilter("ignore") popt, _ = curve_fit(gauss, x, y, p0=p0) return popt