Skip to content
Snippets Groups Projects
Commit d3e656b3 authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

Fixes timFactorFromTable

parent d0b91c37
No related branches found
No related tags found
1 merge request!11Tim calibration table
......@@ -600,13 +600,13 @@ def timFactorFromTable(voltage, photonEnergy, mcp=1):
f: calibration factor in microjoule per APD signal
'''
energies = np.sort([key for key in tim_calibration_table])
if photonEnergy not in photon_energies:
if photonEnergy not in energies:
if photonEnergy > energies.max():
photonEnergy = energies.max()
elif photonEnergy < energies.min():
photonEnergy = energies.min()
else:
idx = np.searchsorted(photon_energies, energy) - 1
idx = np.searchsorted(energies, photonEnergy) - 1
polyA = np.poly1d(tim_calibration_table[energies[idx]][mcp-1])
polyB = np.poly1d(tim_calibration_table[energies[idx+1]][mcp-1])
fA = -np.exp(polyA(voltage))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment