From b9b26f8a26c49c9c27ad4b8362425c42eaffcb11 Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Wed, 14 Aug 2024 11:32:59 +0200 Subject: [PATCH] Apply padding to more AGIPD constants when loading --- src/calng/corrections/AgipdCorrection.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/calng/corrections/AgipdCorrection.py b/src/calng/corrections/AgipdCorrection.py index c69436b9..17b37ac0 100644 --- a/src/calng/corrections/AgipdCorrection.py +++ b/src/calng/corrections/AgipdCorrection.py @@ -470,9 +470,6 @@ class AgipdBaseRunner(base_kernel_runner.BaseKernelRunner): else: self.md_additional_offset.fill(0) elif constant is Constants.SlopesFF: - # Always has 352 cells, so allocating the right size in - # rel_gain_map fixes the shape problems here. - # constant shape: y, x, memory cell if constant_data.shape[2] == 2: # TODO: remove support for old format @@ -486,9 +483,9 @@ class AgipdBaseRunner(base_kernel_runner.BaseKernelRunner): self._constant_memory_cells, ), ) - self.xray_gain_map[:] = self._xp.asarray( + self.xray_gain_map[:] = self._pad_constant(self._xp.asarray( constant_data.transpose(), dtype=np.float32 - )[:self._constant_memory_cells] + ), value=1.0)[:self._constant_memory_cells] else: assert constant in bad_pixel_constants if ( @@ -507,7 +504,7 @@ class AgipdBaseRunner(base_kernel_runner.BaseKernelRunner): ): # BadPixelsFF is not per gain stage - broadcasting along gain constant_data = self._xp.broadcast_to( - constant_data.transpose()[ + self._pad_constant(constant_data.transpose())[ :self._constant_memory_cells, ..., np.newaxis ], self._gm_map_shape, @@ -518,7 +515,7 @@ class AgipdBaseRunner(base_kernel_runner.BaseKernelRunner): ): # old BadPixelsPC have different axis order constant_data = self._xp.broadcast_to( - constant_data.transpose((0, 2, 1))[ + self._pad_constant(constant_data.transpose((0, 2, 1)))[ :self._constant_memory_cells, ..., np.newaxis ], self._gm_map_shape, -- GitLab