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

Renames timFactorFromVoltage() to timFactorFromTable() and makes photonEnergy an argument

parent 1e08ab01
No related branches found
No related tags found
No related merge requests found
......@@ -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
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