Commit ff5cc58b authored by feichtinger's avatar feichtinger
Browse files

adding equations and text. Cleaning. First distribution based calc

parent e6c5b49c
This diff is collapsed.
......@@ -1571,6 +1571,14 @@ physdf = pd.concat([data_mean.reset_index().set_index('SPECTRUM_CENTER'), tmpdf]
physdf.head()
# -
# The Electromultiplier signals like CALCS should be proportional to the number of photoions hitting the detector (multiplier was operated within the linear voltage range). We do not know the number of photons hitting the EM, but we know that it must be proportional to the number of photons $N_{ph}$ in the beam, which we obtain from the ion current detector.
#
# \begin{aligned} N_{ph} = \frac{\Phi}{\hbar \omega} = \frac{k}{e} \dot{} \frac{I_{\text {ion}} T}{\gamma \sigma z p} \end{aligned}
#
# In the present data set we already get the avg. photon energy per pulse, so we can get the average photons per pulse directly by
#
# \begin{aligned} N_{ph} = \frac{{\text {PE}}_{\text {avg}}}{\hbar \omega} \end{aligned}
physdf['Nsigma_avg'] = physdf['PHOTON-ENERGY-PER-PULSE'] * physdf['cross-section'] / physdf['SPECTRUM_CENTER']
physdf['Nphot_avg'] = physdf['PHOTON-ENERGY-PER-PULSE'] / physdf['SPECTRUM_CENTER']
physdf['CALCSUM'] = physdf.CALCS + physdf.CALCT
......@@ -1646,6 +1654,7 @@ import scipy
# Try to define the gain based function
# \begin{aligned} {\text {CALCS}} = N_{phot} \cdot k_{gain} \cdot Voltage_{EM}^{k_{instrument}} \end{aligned}
# x is composed of 2 arrays: [ nphot, EMvoltage]
def calcs_fn(x, kcoeff, kpow):
......@@ -1669,9 +1678,15 @@ popt, pcov = scipy.optimize.curve_fit(calcs_fn,
popt
plt.plot(tmpdf.Nphot_avg, tmpdf.CALCS,
tmpdf.Nphot_avg, calcs_fn([tmpdf.Nphot_avg, tmpdf.XeMultVoltag], popt[0], popt[1]),
linestyle='', marker='o')
# +
fig, ax = plt.subplots()
ax.plot(tmpdf.Nphot_avg, tmpdf.CALCS, label='data',linestyle='', marker='o')
ax.plot(tmpdf.Nphot_avg, calcs_fn([tmpdf.Nphot_avg, tmpdf.XeMultVoltag], popt[0], popt[1]),
label='fit', linestyle='', marker='o')
ax.legend()
# -
popt, pcov = scipy.optimize.curve_fit(calcs_fn,
[ physdf.Nphot_avg, physdf.XeMultVoltag ],
......@@ -1682,8 +1697,16 @@ popt, pcov = scipy.optimize.curve_fit(calcs_fn,
popt
plt.plot(physdf.Nphot_avg, physdf.CALCS,
physdf.Nphot_avg, calcs_fn([physdf.Nphot_avg, physdf.XeMultVoltag], popt[0], popt[1]),
fig, ax = plt.subplots()
ax.plot(physdf.Nphot_avg, physdf.CALCS, label='data',linestyle='', marker='o')
ax.plot(physdf.Nphot_avg, calcs_fn([physdf.Nphot_avg, physdf.XeMultVoltag], popt[0], popt[1]),
label='fit', linestyle='', marker='o')
ax.legend()
# measured vs. predicted
plt.plot(physdf.CALCS,
calcs_fn([physdf.Nphot_avg, physdf.XeMultVoltag], popt[0], popt[1]),
linestyle='', marker='o', alpha=0.6)
fig,ax = plt.subplots()
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment