mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-11 06:47:14 +02:00
Merge branch 'main' into developer
This commit is contained in:
@ -8,6 +8,7 @@ import numpy as np
|
||||
import boost_histogram as bh
|
||||
import time
|
||||
|
||||
|
||||
import aare
|
||||
|
||||
data = np.random.normal(10, 1, 1000)
|
||||
@ -19,4 +20,31 @@ hist.fill(data)
|
||||
x = hist.axes[0].centers
|
||||
y = hist.values()
|
||||
y_err = np.sqrt(y)+1
|
||||
res = aare.fit_gaus(x, y, y_err, chi2 = True)
|
||||
res = aare.fit_gaus(x, y, y_err, chi2 = True)
|
||||
|
||||
|
||||
|
||||
t_elapsed = time.perf_counter()-t0
|
||||
print(f'Histogram filling took: {t_elapsed:.3f}s {total_clusters/t_elapsed/1e6:.3f}M clusters/s')
|
||||
|
||||
histogram_data = hist3d.counts()
|
||||
x = hist3d.axes[2].edges[:-1]
|
||||
|
||||
y = histogram_data[100,100,:]
|
||||
xx = np.linspace(x[0], x[-1])
|
||||
# fig, ax = plt.subplots()
|
||||
# ax.step(x, y, where = 'post')
|
||||
|
||||
y_err = np.sqrt(y)
|
||||
y_err = np.zeros(y.size)
|
||||
y_err += 1
|
||||
|
||||
# par = fit_gaus2(y,x, y_err)
|
||||
# ax.plot(xx, gaus(xx,par))
|
||||
# print(par)
|
||||
|
||||
res = fit_gaus(y,x)
|
||||
res2 = fit_gaus(y,x, y_err)
|
||||
print(res)
|
||||
print(res2)
|
||||
|
||||
|
Reference in New Issue
Block a user