From caf8187dd1cc3cfdb1a0e793df1ec28e9a096bc3 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 5 Nov 2026 13:47:39 +0100 Subject: [PATCH] broker: accept adaptive_threshold on FPGA spot-finding detectors and ignore it PUT /config/spot_finding no longer answers 400 when adaptive_threshold is set on a JUNGFRAU or EIGER broker. Those workflows find spots on the FPGA at its own fixed threshold, so the setting is stored and simply not used there; the DECTRIS/SIMPLON workflow keeps using it. This matches what the config file already did and lets one set of spot-finding settings be shared across detectors. The API description, its generated C++ model, frontend client, Python client docs and Redoc page, and the image-analysis doc now say the setting is ignored rather than refused. A state-machine test checks the setting is accepted on a JUNGFRAU configuration. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdL4qBGYRiSXSGXfCLu --- broker/JFJochStateMachine.cpp | 9 --------- broker/gen/model/Spot_finding_settings.h | 2 +- broker/jfjoch_api.yaml | 6 +++--- broker/redoc-static.html | 8 ++++---- docs/CPU_DATA_ANALYSIS_IMAGE.md | 2 +- docs/python_client/docs/SpotFindingSettings.md | 2 +- frontend/src/client/types.gen.ts | 6 +++--- tests/JFJochStateMachineTest.cpp | 17 +++++++++++++++++ 8 files changed, 30 insertions(+), 22 deletions(-) diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 2ce46530e..1109517a2 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -790,15 +790,6 @@ void JFJochStateMachine::GetPlotRaw(std::vector &v, PlotType type, const void JFJochStateMachine::SetSpotFindingSettings(const SpotFindingSettings &settings) { std::unique_lock ul(data_processing_settings_mutex); DiffractionExperiment::CheckDataProcessingSettings(settings); - // The adaptive threshold is a property of the software spot finder, which only the DECTRIS - // (SIMPLON) workflow runs - JUNGFRAU and EIGER find spots on the FPGA, at its own fixed - // threshold. Refuse it there rather than accept it and do nothing: a silently ignored detection - // setting is indistinguishable from one that had no effect on the data. - if (settings.adaptive_threshold && experiment.GetDetectorType() != DetectorType::DECTRIS) - throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, - "Adaptive spot-finding threshold is not available on this detector: spots " - "are found on the FPGA, which applies its own fixed threshold"); - data_processing_settings = settings; services.SetSpotFindingSettings(data_processing_settings); diff --git a/broker/gen/model/Spot_finding_settings.h b/broker/gen/model/Spot_finding_settings.h index 060854ec2..bca1aa0c2 100644 --- a/broker/gen/model/Spot_finding_settings.h +++ b/broker/gen/model/Spot_finding_settings.h @@ -124,7 +124,7 @@ public: bool highResGapQRecipAIsSet() const; void unsetHigh_res_gap_Q_recipA(); /// - /// Self-calibrating spot detection: replace the fixed photon_count_threshold by a per-resolution-ring threshold derived from each image's own noise, so the same setting works across datasets without per-dataset tuning. photon_count_threshold is then ignored and false_pixels_per_frame sets the operating point instead. Only available on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold, so enabling this there is rejected rather than silently ignored. + /// Self-calibrating spot detection: replace the fixed photon_count_threshold by a per-resolution-ring threshold derived from each image's own noise, so the same setting works across datasets without per-dataset tuning. photon_count_threshold is then ignored and false_pixels_per_frame sets the operating point instead. Used only on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold; there the setting is accepted and ignored, so the same settings can be shared across detectors. /// bool isAdaptiveThreshold() const; void setAdaptiveThreshold(bool const value); diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 281f54bb3..45a57b664 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -1180,9 +1180,9 @@ components: threshold derived from each image's own noise, so the same setting works across datasets without per-dataset tuning. photon_count_threshold is then ignored and false_pixels_per_frame sets the operating point instead. - Only available on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). - The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold, - so enabling this there is rejected rather than silently ignored. + Used only on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). + The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold; + there the setting is accepted and ignored, so the same settings can be shared across detectors. false_pixels_per_frame: type: number format: float diff --git a/broker/redoc-static.html b/broker/redoc-static.html index f1305a86c..b17a76036 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -791,9 +791,9 @@ This option should be turned OFF for small molecule datasets or for crystals wit threshold derived from each image's own noise, so the same setting works across datasets without per-dataset tuning. photon_count_threshold is then ignored and false_pixels_per_frame sets the operating point instead. -Only available on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). -The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold, -so enabling this there is rejected rather than silently ignored.

+Used only on detectors whose images are analysed in software (the DECTRIS/SIMPLON workflow). +The JUNGFRAU and EIGER workflows find spots on the FPGA, which applies its own fixed threshold; +there the setting is accepted and ignored, so the same settings can be shared across detectors.

false_pixels_per_frame
number <float> [ 1 .. 100000 ]
Default: 100

Operating point of the adaptive threshold: the number of noise pixels tolerated per frame. About 100 suits a multi-megapixel detector. Ignored unless adaptive_threshold is set.

Responses