Skip to content
Snippets Groups Projects

Calculate SNR and some bug fixes

Merged Danilo Enoque Ferreira de Lima requested to merge snr into main
+ 5
3
@@ -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):
Loading