Skip to content

Commit b28d108

Browse files
committed
added compatibility for python 3.11+
1 parent 98770f2 commit b28d108

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

irrad_spectroscopy/spectroscopy.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
from scipy.integrate import quad
1919
from scipy.interpolate import interp1d
2020

21+
try:
22+
from inspect import getfullargspec as get_args
23+
except ImportError:
24+
from inspect import getargspec as get_args
25+
2126

2227
# set logging level when doing import
2328
logging.getLogger().setLevel(logging.INFO)
@@ -529,7 +534,7 @@ def tmp_fit(x, *args):
529534
finally:
530535
k += .5
531536
_p0 = {'mu': _mu, 'sigma': _sigma, 'h': y_peak}
532-
fit_args = inspect.getargspec(peak_fit)[0][1:]
537+
fit_args = get_args(peak_fit)[0][1:]
533538
p0 = tuple(_p0[arg] if arg in _p0 else 1 for arg in fit_args)
534539
popt, pcov = curve_fit(tmp_fit, x_fit, y_fit, p0=p0, sigma=np.sqrt(y_fit), absolute_sigma=True, maxfev=5000)
535540
perr = np.sqrt(np.diag(pcov)) # get std deviation

0 commit comments

Comments
 (0)