diff --git a/pes_to_spec/model.py b/pes_to_spec/model.py index 726921e385cfc232fa03b7b359e4149d2cd814f4..5bc0bde187d3007ec3c4ee238db633ac79262e0e 100644 --- a/pes_to_spec/model.py +++ b/pes_to_spec/model.py @@ -109,7 +109,9 @@ def deconv(y: np.ndarray, yhat: np.ndarray) -> Dict[str, Any]: sigma_s = np.real(np.sqrt(np.sum(H2*Syy)/n_bins)) snr = sigma_s/sigma_n - return dict(h=np.fft.fftshift(np.fft.ifft(H)), + h = np.real(np.absolute(np.fft.fftshift(np.fft.ifft(H)))) + + return dict(h=h, H=H, H2=H2, Syy=Syy, @@ -152,8 +154,8 @@ def get_resolution(y: np.ndarray, y_hat: np.ndarray, e: np.ndarray, y_hat_sel = y_hat_sel*f results = deconv(y_sel, y_hat_sel) results["e_axis"] = e_axis - results["fit"] = fit_gaussian(e_axis, np.absolute(h)) - results["fit_success"] = results["fit"].covar_ is not None + results["fit"] = fit_gaussian(e_axis, results["h"]) + results["fit_success"] = results["fit"].covar is not None return results class PromptNotFoundError(Exception):