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
No related merge requests found
...@@ -600,13 +600,13 @@ def timFactorFromTable(voltage, photonEnergy, mcp=1): ...@@ -600,13 +600,13 @@ def timFactorFromTable(voltage, photonEnergy, mcp=1):
f: calibration factor in microjoule per APD signal f: calibration factor in microjoule per APD signal
''' '''
energies = np.sort([key for key in tim_calibration_table]) 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(): if photonEnergy > energies.max():
photonEnergy = energies.max() photonEnergy = energies.max()
elif photonEnergy < energies.min(): elif photonEnergy < energies.min():
photonEnergy = energies.min() photonEnergy = energies.min()
else: else:
idx = np.searchsorted(photon_energies, energy) - 1 idx = np.searchsorted(energies, photonEnergy) - 1
polyA = np.poly1d(tim_calibration_table[energies[idx]][mcp-1]) polyA = np.poly1d(tim_calibration_table[energies[idx]][mcp-1])
polyB = np.poly1d(tim_calibration_table[energies[idx+1]][mcp-1]) polyB = np.poly1d(tim_calibration_table[energies[idx+1]][mcp-1])
fA = -np.exp(polyA(voltage)) 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