Skip to content

Commit

Permalink
zdc_*: use maxfev=10000
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Oct 23, 2024
1 parent 958f6cb commit 33be27a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions benchmarks/zdc_lambda/analysis/lambda_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def gauss(x, A,mu, sigma):
fnc=gauss
p0=[100, 0, 0.05]
coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0,
sigma=np.sqrt(y[slc])+(y[slc]==0))
sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000)
x=np.linspace(-1, 1)
plt.plot(x, gauss(x, *coeff), color='tab:orange')
plt.xlabel("$\\theta^{*\\rm recon}_{\\Lambda}-\\theta^{*\\rm truth}_{\\Lambda}$ [mrad]")
Expand All @@ -214,7 +214,7 @@ def gauss(x, A,mu, sigma):
#print(bc[slc],y[slc])
sigma=np.sqrt(y[slc])+(y[slc]==0)
try:
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,sigma=list(sigma))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0, sigma=list(sigma), maxfev=10000)
sigmas.append(coeff[2])
dsigmas.append(np.sqrt(var_matrix[2][2]))
xvals.append(p)
Expand Down Expand Up @@ -259,7 +259,7 @@ def gauss(x, A,mu, sigma):
fnc=gauss
p0=[100, 0, 1]
coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0,
sigma=np.sqrt(y[slc])+(y[slc]==0))
sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000)
x=np.linspace(-5, 5)
plt.plot(x, gauss(x, *coeff), color='tab:orange')
print(coeff[2], np.sqrt(var_matrix[2][2]))
Expand All @@ -284,7 +284,7 @@ def gauss(x, A,mu, sigma):
#print(bc[slc],y[slc])
sigma=np.sqrt(y[slc])+(y[slc]==0)
try:
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,sigma=list(sigma))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0, sigma=list(sigma), maxfev=10000)
sigmas.append(coeff[2])
dsigmas.append(np.sqrt(var_matrix[2][2]))
xvals.append(p)
Expand Down Expand Up @@ -327,7 +327,7 @@ def gauss(x, A,mu, sigma):
fnc=gauss
p0=[100, lambda_mass, 0.04]
coeff, var_matrix = curve_fit(fnc, bc[slc], y[slc], p0=p0,
sigma=np.sqrt(y[slc])+(y[slc]==0))
sigma=np.sqrt(y[slc])+(y[slc]==0), maxfev=10000)
x=np.linspace(0.8, 1.3, 200)
plt.plot(x, gauss(x, *coeff), color='tab:orange')
print(coeff[2], np.sqrt(var_matrix[2][2]))
Expand All @@ -350,7 +350,7 @@ def gauss(x, A,mu, sigma):
p0=[100, lambda_mass, 0.05]
try:
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
x=np.linspace(0.8, 1.3, 200)
sigmas.append(coeff[2])
dsigmas.append(np.sqrt(var_matrix[2][2]))
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/zdc_photon/analysis/zdc_photon_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def gauss(x, A,mu, sigma):
p0=[100, p, 10]
#print(list(y), list(x))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
if p==100:
xx=np.linspace(p*0.75,p*1.25, 100)
plt.plot(xx, fnc(xx,*coeff))
Expand All @@ -78,7 +78,7 @@ def gauss(x, A,mu, sigma):
fnc=lambda E,a: a/np.sqrt(E)
#pvals, resvals, dresvals
coeff, var_matrix = curve_fit(fnc, pvals, resvals, p0=(1,),
sigma=dresvals)
sigma=dresvals, maxfev=10000)

xx=np.linspace(15, 275, 100)
plt.plot(xx, fnc(xx, *coeff), label=f'fit: $\\frac{{{coeff[0]*100:.0f}\\%}}{{\\sqrt{{E}}}}$')
Expand Down Expand Up @@ -129,7 +129,7 @@ def gauss(x, A,mu, sigma):
p0=[100, 0, 0.1]
#print(list(y), list(x))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
if p==100:
xx=np.linspace(-0.5,0.5, 100)
plt.plot(xx, fnc(xx,*coeff))
Expand All @@ -143,7 +143,7 @@ def gauss(x, A,mu, sigma):
fnc=lambda E,a, b: np.hypot(a/np.sqrt(E), b)
#pvals, resvals, dresvals
coeff, var_matrix = curve_fit(fnc, pvals, resvals, p0=(1,.1),
sigma=dresvals)
sigma=dresvals, maxfev=10000)

xx=np.linspace(15, 275, 100)

Expand Down
12 changes: 6 additions & 6 deletions benchmarks/zdc_pi0/analysis/zdc_pi0_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def gauss(x, A,mu, sigma):
p0=[100, p, 10]
#print(list(y), list(x))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
if p==100:
xx=np.linspace(p*0.5,p*1.5, 100)
plt.plot(xx, fnc(xx,*coeff))
Expand All @@ -76,7 +76,7 @@ def gauss(x, A,mu, sigma):
fnc=lambda E,a: a/np.sqrt(E)
#pvals, resvals, dresvals
coeff, var_matrix = curve_fit(fnc, pvals, resvals, p0=(1,),
sigma=dresvals)
sigma=dresvals, maxfev=10000)
xx=np.linspace(55, 200, 100)
plt.plot(xx, fnc(xx, *coeff), label=f'fit: $\\frac{{{coeff[0]:.2f}\\%}}{{\\sqrt{{E}}}}$')
plt.legend()
Expand Down Expand Up @@ -133,7 +133,7 @@ def gauss(x, A,mu, sigma):
p0=[100, 0, 0.1]
#print(list(y), list(x))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
if p==100:
xx=np.linspace(-0.5,0.5, 100)
plt.plot(xx, fnc(xx,*coeff))
Expand All @@ -148,7 +148,7 @@ def gauss(x, A,mu, sigma):
fnc=lambda E,a: a/np.sqrt(E)
#pvals, resvals, dresvals
coeff, var_matrix = curve_fit(fnc, pvals, resvals, p0=(1,),
sigma=dresvals)
sigma=dresvals, maxfev=10000)

xx=np.linspace(55, 200, 100)

Expand Down Expand Up @@ -201,7 +201,7 @@ def gauss(x, A,mu, sigma):
p0=[100, .135, 0.2]
#print(list(y), list(x))
coeff, var_matrix = curve_fit(fnc, list(bc[slc]), list(y[slc]), p0=p0,
sigma=list(np.sqrt(y[slc])+(y[slc]==0)))
sigma=list(np.sqrt(y[slc])+(y[slc]==0)), maxfev=10000)
if p==100:
xx=np.linspace(0,0.2)
plt.plot(xx, fnc(xx,*coeff))
Expand All @@ -218,7 +218,7 @@ def gauss(x, A,mu, sigma):
fnc=lambda E,a,b: a+b*E
#pvals, resvals, dresvals
coeff, var_matrix = curve_fit(fnc, pvals, resvals, p0=(1,1),
sigma=dresvals)
sigma=dresvals, maxfev=10000)
xx=np.linspace(55, 200, 100)
#plt.plot(xx, fnc(xx, *coeff), label=f'fit: ${coeff[0]*1000:.1f}+{coeff[1]*1000:.4f}\\times E$ MeV')
plt.plot(xx, fnc(xx, *coeff), label=f'fit: $({coeff[0]*1000:.1f}+{coeff[1]*1000:.4f}\\times [E\,in\,GeV])$ MeV')
Expand Down

0 comments on commit 33be27a

Please sign in to comment.