Insert gap pixels only between chips unless module gaps are set
Build on RHEL9 / build (push) Successful in 3m1s
Build on RHEL8 / build (push) Successful in 3m43s
Run tests using data on local RHEL8 / build (push) Failing after 4m48s

An unset GapPixels::module_gaps defaulted to the chip gap, so every
module boundary received two extra rows or columns. Two stacked
Jungfrau modules read as 1030x1030 instead of 1030x1028. Unset now
means no pixels between modules; only the chip boundaries inside a
module receive a gap.

Also drop the explicit lambda capture in split_edge_counts that clang
reported as unused for floating point pixels.
This commit is contained in:
Erik Fröjdh committed 2026-10-09 21:59:07 +02:00
1 parent 6bfe6c2284
commit 58da96d6f0
10 files changed
+76 -35

No files matched your search

+3 -4
View File
@@ -32,8 +32,7 @@ py::array insert_gap_pixels_typed(const py::array &image, const ROI &roi,
void define_gap_pixels_bindings(py::module &m) {
py::class_<ModuleGaps>(m, "ModuleGaps", R"(
Pixels inserted at each boundary between modules, replacing the chip
gap there.
Pixels inserted at each boundary between modules.
)")
.def(py::init<>())
.def(py::init<ssize_t, ssize_t>(), py::arg("x"), py::arg("y"))
@@ -55,8 +54,8 @@ void define_gap_pixels_bindings(py::module &m) {
Pixels inserted at each chip boundary inside a module. Source
column 255 expands to the right and column 256 to the left.
module_gaps : ModuleGaps, optional
Pixels inserted at module boundaries instead of the chip gap.
None means module boundaries receive the chip gap.
Pixels inserted at module boundaries. None means no pixels are
inserted between modules.
fill_value : float
Value written to gap pixels, converted to the pixel type. Module
gaps always receive this value.
+11 -1
View File
@@ -34,7 +34,7 @@ def test_configuration_defaults_and_equality():
def test_gapped_shape():
assert gapped_shape(ROI(0, 1024, 0, 512), DetectorType.Jungfrau) == (514, 1030)
assert gapped_shape(ROI(0, 1024, 0, 1024), DetectorType.Jungfrau) == (1030, 1030)
assert gapped_shape(ROI(0, 1024, 0, 1024), DetectorType.Jungfrau) == (1028, 1030)
assert gapped_shape(ROI(0, 1024, 0, 1024), DetectorType.Jungfrau, GapPixels(module_gaps=ModuleGaps(8, 36))) == (1064, 1030)
assert gapped_shape(ROI(0, 512, 0, 512), DetectorType.Eiger, quad=True) == (514, 514)
assert gapped_shape(ROI(256, 512, 0, 256), DetectorType.Jungfrau) == (256, 256)
@@ -54,6 +54,16 @@ def test_insert_gap_pixels_matches_numpy(dtype):
assert (result == expected).all()
def test_insert_gap_pixels_without_module_gaps():
# two stacked modules: chip gaps at rows 256 and 768, none at the module
# boundary at row 512
image = np.arange(1024 * 1024, dtype=np.uint32).reshape(1024, 1024)
result = insert_gap_pixels(image, DetectorType.Jungfrau)
expected = reference(image, [(256, 2), (512, 2), (768, 2)], [(256, 2), (768, 2)])
assert result.shape == (1028, 1030)
assert (result == expected).all()
def test_insert_gap_pixels_with_module_gaps():
image = np.arange(1024 * 1024, dtype=np.uint32).reshape(1024, 1024)
gaps = GapPixels(module_gaps=ModuleGaps(8, 36), fill_value=9)
+3 -2
View File
@@ -527,8 +527,9 @@ def test_raw_file_gap_pixels(tmp_path, layout):
gaps = GapPixels(fill_value=5)
with RawFile(master_path, gap_pixels=gaps) as reader:
assert reader.gap_pixels == gaps
assert (reader.rows(), reader.cols()) == (512 * layout_rows + 2 * (layout_rows * 2 - 1),
1024 * layout_cols + 2 * (layout_cols * 4 - 1))
# one chip boundary per module row, three per module column and no
# gap between modules
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()