From ac3419220107cf6b722f7620db9ba44c233f458a Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 23 Sep 2026 21:17:42 +0200 Subject: [PATCH] pixel_mask_applied is false on the DECTRIS broker path The mask written with the data is Jungfraujoch's (the detector's own plus user masking) and is never uploaded to the detector. The stream's pixel_mask_enabled only says the detector applied ITS mask, so it does not describe the mask in the file; on this path that mask is never applied. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013nW6FNRP1bBJJ8pfHiByAT --- receiver/JFJochReceiverLite.cpp | 4 +++- tests/JFJochReceiverLiteTest.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/receiver/JFJochReceiverLite.cpp b/receiver/JFJochReceiverLite.cpp index bd550ffa3..001a8f6f5 100644 --- a/receiver/JFJochReceiverLite.cpp +++ b/receiver/JFJochReceiverLite.cpp @@ -224,7 +224,9 @@ void JFJochReceiverLite::Configure(const StartMessage &msg) { experiment.Detector().CountRateCorrectionLookupTable(msg.countrate_correction_lookup_table); experiment.Detector().FlatfieldApplied(msg.flatfield_enabled); experiment.Detector().VirtualPixelInterpolationApplied(msg.virtual_pixel_interpolation_enabled); - experiment.ApplyPixelMask(msg.pixel_mask_enabled); + // The mask written with the data is ours (the detector's plus user masking); it is never + // uploaded to the detector, so the pixels arrive without it applied. + experiment.ApplyPixelMask(false); // Images are forwarded byte-for-byte, so the stream's own image_dtype - not anything configured // locally - decides both the width and the sign the outgoing metadata must declare. Taking only // the width used to leave a signed stream declared unsigned in NXmx. diff --git a/tests/JFJochReceiverLiteTest.cpp b/tests/JFJochReceiverLiteTest.cpp index f03001877..bcfe1167d 100644 --- a/tests/JFJochReceiverLiteTest.cpp +++ b/tests/JFJochReceiverLiteTest.cpp @@ -55,8 +55,8 @@ TEST_CASE("JFJochReceiverLite", "[JFJochReceiver]") { start_msg.flatfield_enabled = true; start_msg.countrate_correction_lookup_table = {0, 1, 3, 7}; start_msg.virtual_pixel_interpolation_enabled = true; - // What the detector did to the pixels, not the local setting - start_msg.pixel_mask_enabled = !experiment.IsApplyPixelMask(); + // The detector applied its own mask, not the one written with the data + start_msg.pixel_mask_enabled = true; puller->Put(ImagePullerOutput{ .cbor = std::make_shared(start_msg) @@ -112,7 +112,7 @@ TEST_CASE("JFJochReceiverLite", "[JFJochReceiver]") { CHECK(master.GetBool("/entry/instrument/detector/countrate_correction_applied")); CHECK(master.GetBool("/entry/instrument/detector/flatfield_applied")); CHECK(master.GetBool("/entry/instrument/detector/virtual_pixel_interpolation_applied")); - CHECK(master.GetBool("/entry/instrument/detector/pixel_mask_applied") == start_msg.pixel_mask_enabled); + CHECK(!master.GetBool("/entry/instrument/detector/pixel_mask_applied")); CHECK(master.ReadVector("/entry/instrument/detector/countrate_correction_lookup_table") == std::vector{0, 1, 3, 7}); }