Drop detector type and quad flag from the gap pixel API
Build on RHEL9 / build (push) Successful in 2m55s
Build on RHEL8 / build (push) Successful in 3m39s
Run tests using data on local RHEL8 / build (push) Failing after 4m43s

insert_gap_pixels and gapped_shape only used the detector type to reject
anything but Jungfrau and Eiger, and the quad flag only to shrink the
module width to 512. Both Jungfrau and Eiger use 256x256 pixel chips in
1024x512 modules, and an Eiger quad is 512x512 pixels, so its only chip
boundaries are at pixel 256 and the module width never matters. The
layout is now fixed and both functions take just the image, its ROI and
the GapPixels configuration, in C++ and in Python.

RawFile keeps rejecting gap pixels for other detector types with
std::invalid_argument, now checked in the reader instead of the layout.
This commit is contained in:
Erik Fröjdh committed 2026-10-13 12:35:36 +02:00
1 parent f9216897fd
commit 34f0d9f679
11 files changed
+157 -230

No files matched your search

+8 -8
View File
@@ -532,7 +532,7 @@ def test_raw_file_gap_pixels(tmp_path, layout):
assert (reader.rows(), reader.cols()) == ((512 + 2) * layout_rows, (1024 + 6) * layout_cols)
header, image = reader.read_frame()
assert header.size == layout_rows * layout_cols
assert (image == insert_gap_pixels(expected, DetectorType.Jungfrau, gaps)).all()
assert (image == insert_gap_pixels(expected, gaps)).all()
reader.seek(0)
_, images = reader.read_n(2)
assert images.shape == (2, reader.rows(), reader.cols())
@@ -545,15 +545,15 @@ def test_raw_file_gap_pixels(tmp_path, layout):
with RawFile(master_path, gap_pixels=True) as reader:
assert reader.gap_pixels == GapPixels()
_, image = reader.read_frame()
assert (image == insert_gap_pixels(expected, DetectorType.Jungfrau)).all()
assert (image == insert_gap_pixels(expected)).all()
with File(master_path, gap_pixels=True) as reader:
assert (reader.rows, reader.cols) == insert_gap_pixels(expected, DetectorType.Jungfrau).shape
assert (reader.read_frame() == insert_gap_pixels(expected, DetectorType.Jungfrau)).all()
assert (reader.rows, reader.cols) == insert_gap_pixels(expected).shape
assert (reader.read_frame() == insert_gap_pixels(expected)).all()
module_gaps = GapPixels(module_gaps=ModuleGaps(8, 36))
with File(master_path, gap_pixels=module_gaps) as reader:
assert (reader.read_frame() == insert_gap_pixels(expected, DetectorType.Jungfrau, module_gaps)).all()
assert (reader.read_frame() == insert_gap_pixels(expected, module_gaps)).all()
def test_raw_file_gap_pixels_split_counts(tmp_path):
@@ -561,7 +561,7 @@ def test_raw_file_gap_pixels_split_counts(tmp_path):
gaps = GapPixels(split_counts=True, seed=11)
with RawFile(master_path, gap_pixels=gaps) as reader:
_, image = reader.read_frame()
assert (image == insert_gap_pixels(expected, DetectorType.Jungfrau, gaps)).all()
assert (image == insert_gap_pixels(expected, gaps)).all()
assert image.sum() == expected.sum()
@@ -583,7 +583,7 @@ def test_raw_file_gap_pixels_recorded_jungfrau(test_data_path):
_, image = gapped.read_frame()
_, reference = plain.read_frame()
assert image.shape == (514, 1030)
assert (image == insert_gap_pixels(reference, DetectorType.Jungfrau, gaps)).all()
assert (image == insert_gap_pixels(reference, gaps)).all()
@pytest.mark.withdata
@@ -597,7 +597,7 @@ def test_raw_file_gap_pixels_recorded_rois(test_data_path):
assert images[0].shape == (303, 103)
assert images[1].shape == (101, 103)
for image, reference, roi in zip(images, references, rois):
assert (image == insert_gap_pixels(reference, DetectorType.Jungfrau, roi=roi)).all()
assert (image == insert_gap_pixels(reference, roi=roi)).all()
gapped.seek(0)
_, frames = gapped.read_n_with_roi(2, roi_index=1)
assert frames.shape == (2, 101, 103)