From 22754ceff91033aa43fd4e9e6a5367f44b9dcb03 Mon Sep 17 00:00:00 2001 From: NichtJens Date: Fri, 22 Mar 2024 11:25:51 +0100 Subject: [PATCH] added get_detector_temperatures endpoint --- sf_daq_broker/broker_manager_slow.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sf_daq_broker/broker_manager_slow.py b/sf_daq_broker/broker_manager_slow.py index ac159e0..e0248df 100644 --- a/sf_daq_broker/broker_manager_slow.py +++ b/sf_daq_broker/broker_manager_slow.py @@ -36,6 +36,30 @@ conv_detector_gain_settings_reverse = dict(zip(conv_detector_gain_settings.value class DetectorManager: + def get_detector_temperatures(self, request, remote_ip): + validate.request_has(request, "detector_name") + + beamline = get_beamline(remote_ip) + allowed_detectors_beamline = get_configured_detectors(beamline) + + detector_name = request["detector_name"] + + validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline) + + detector_number = int(detector_name[2:4]) + detector = Jungfrau(detector_number) + + temperatures = {t.name: detector.getTemperature(t) for t in detector.getTemperatureList()} + temperatures["TEMPERATURE_THRESHOLDS"] = detector.getThresholdTemperature() + + res = { + "status": "ok", + "message": f"successfully retrieved temperatures from {detector_name}", + "temperatures": temperatures + } + return res + + def get_detector_settings(self, request, remote_ip): validate.request_has(request, "detector_name")