From b28d108e1150a49664d7ffe806254704da9bf24f Mon Sep 17 00:00:00 2001 From: Klaas Padeken Date: Mon, 26 Feb 2024 13:55:16 +0100 Subject: [PATCH] added compatibility for python 3.11+ --- irrad_spectroscopy/spectroscopy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/irrad_spectroscopy/spectroscopy.py b/irrad_spectroscopy/spectroscopy.py index 7d58c35..aad217a 100644 --- a/irrad_spectroscopy/spectroscopy.py +++ b/irrad_spectroscopy/spectroscopy.py @@ -18,6 +18,11 @@ from scipy.integrate import quad from scipy.interpolate import interp1d +try: + from inspect import getfullargspec as get_args +except ImportError: + from inspect import getargspec as get_args + # set logging level when doing import logging.getLogger().setLevel(logging.INFO) @@ -529,7 +534,7 @@ def tmp_fit(x, *args): finally: k += .5 _p0 = {'mu': _mu, 'sigma': _sigma, 'h': y_peak} - fit_args = inspect.getargspec(peak_fit)[0][1:] + fit_args = get_args(peak_fit)[0][1:] p0 = tuple(_p0[arg] if arg in _p0 else 1 for arg in fit_args) popt, pcov = curve_fit(tmp_fit, x_fit, y_fit, p0=p0, sigma=np.sqrt(y_fit), absolute_sigma=True, maxfev=5000) perr = np.sqrt(np.diag(pcov)) # get std deviation