Skip to content
Snippets Groups Projects
Commit a457afab authored by Dmitry Kalinkin's avatar Dmitry Kalinkin
Browse files

zdc_sigma: ignore failed fit (flaky)

#124
parent a713d319
No related branches found
No related tags found
No related merge requests found
......@@ -235,10 +235,13 @@ from scipy.optimize import curve_fit
slc=abs(bc)<0.6
fnc=gauss
p0=[100, 0, 0.5]
coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0,
sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000)
x=np.linspace(-1, 1)
plt.plot(x, gauss(x, *coeff), color='tab:orange')
try:
coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0,
sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000)
x=np.linspace(-1, 1)
plt.plot(x, gauss(x, *coeff), color='tab:orange')
except RuntimeError:
print("fit failed")
plt.xlabel("$\\theta^{*\\rm recon}_{\\Sigma}-\\theta^{*\\rm truth}_{\\Sigma}$ [mrad]")
plt.ylabel("events")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment