From d3e656b372e97f738e08399f9ff94925a613dbc3 Mon Sep 17 00:00:00 2001 From: mercadil <laurent.mercadier@xfel.eu> Date: Sun, 24 Mar 2019 00:59:34 +0100 Subject: [PATCH] Fixes timFactorFromTable --- xgm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xgm.py b/xgm.py index ddb9eec..5446cbf 100644 --- a/xgm.py +++ b/xgm.py @@ -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)) -- GitLab