Skip to content

Commit

Permalink
Merge pull request #16 from padeken/python311_update
Browse files Browse the repository at this point in the history
added compatibility for python 3.11+
  • Loading branch information
leloup314 committed Mar 6, 2024
2 parents 98770f2 + b28d108 commit b1fa9b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion irrad_spectroscopy/spectroscopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1fa9b6

Please sign in to comment.