From 70ab551b2200db638d3f84c7214c9ad2be1a0c99 Mon Sep 17 00:00:00 2001 From: mercadil <laurent.mercadier@xfel.eu> Date: Sun, 24 Mar 2019 00:05:13 +0100 Subject: [PATCH] Renames timFactorFromVoltage() to timFactorFromTable() and makes photonEnergy an argument --- xgm.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xgm.py b/xgm.py index 8641511..b4a3c64 100644 --- a/xgm.py +++ b/xgm.py @@ -591,7 +591,7 @@ tim_calibration_table = { [ 3.69445588e-11, -1.97731342e-07, 3.98203522e-04, -3.78338599e-01, 1.41894119e+02]]) } -def timFactorFromVoltage(voltage, photonEnergy=None, mcp=1): +def timFactorFromTable(voltage, photonEnergy, mcp=1): ''' Returns an energy calibration factor for TIM integrated peak signal (APD) according to calibration from March 2019, proposal 900074, semester 201930, runs 69 - 111 (Ni edge): https://in.xfel.eu/elog/SCS+Beamline/2323 @@ -603,15 +603,12 @@ def timFactorFromVoltage(voltage, photonEnergy=None, mcp=1): voltage: MCP voltage in volts. photonEnergy: FEL photon energy in eV. Calibration factor is linearly interpolated between the known values from the calibration table. - If None, takes the median photon energy from the calibration table. mcp: MCP channel (1, 2, or 3). Output: f: calibration factor in microjoule per APD signal ''' energies = np.sort([key for key in tim_calibration_table]) - if photonEnergy is None: - photonEnergy = np.median(energies) if photonEnergy not in photon_energies: if photonEnergy > energies.max(): photonEnergy = energies.max() @@ -628,4 +625,3 @@ def timFactorFromVoltage(voltage, photonEnergy=None, mcp=1): poly = np.poly1d(tim_calibration_table[photonEnergy][mcp-1]) f = -np.exp(poly(voltage)) return f - \ No newline at end of file -- GitLab