Skip to content
Snippets Groups Projects
Commit 632a1228 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

Read bias_voltage for AGIPD at SPB and MID from RUN source

parent ea1b0f06
No related branches found
No related tags found
1 merge request!647[AGIPD] Read bias_voltage for AGIPD at SPB and MID from RUN source
......@@ -173,30 +173,39 @@ class AgipdCtrl:
karabo_id_control: str,
module: Optional[int] = 0
) -> int:
"""Read the voltage information from the FPGA device of module 0.
"""Read the voltage information from the RUN source of module 0.
Different modules may operate at different voltages.
In practice, they all operate at the same voltage.
As such, it is okay to read a single module's value.
If the FPGA module source is not available, 300 will be returned.
300 is the default bias_voltage value before adding it to slow data.
If the FPGA/PSC RUN source is not available, 300 will be returned.
300 was the default bias_voltage value for
MID_DET_AGIPD1M-1 and SPB_DET_AGIPD1M-1.
:param karabo_id_control: The detector karabo id, for the control device.
:param karabo_id_control: The karabo deviceId for the CONTROL device.
:param module: defaults to module 0
:return: voltage, a uint16
"""
voltage_src = (
f"{karabo_id_control}/FPGA/M_{module}",
"highVoltage.actual.value")
# TODO: Add a breaking fix by passing the source and key through
# get_bias_voltage arguments.
if "AGIPD1M" in karabo_id_control:
voltage_src = (
f"{karabo_id_control[:-1]}/PSC/HV",
f"channels.U{module}.measurmentSenseVoltage.value")
else: # AGIPD500K
voltage_src = (
f"{karabo_id_control}/FPGA/M_{module}",
"highVoltage.actual.value")
if (
voltage_src[0] in self.run_dc.all_sources and
voltage_src[1] in self.run_dc.keys_for_source(voltage_src[0])
):
return self.run_dc[voltage_src].as_single_value(atol=1, reduce_by='max')
return int(self.run_dc.get_run_value(*voltage_src))
else:
# TODO: Validate if removing this and
# and using NB value for old RAW data.
print(
"WARNING: Unable to read bias_voltage from"
f" {voltage_src[0]}/{voltage_src[1].replace('.','/')} "
......
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