Skip to content
Snippets Groups Projects
Commit 092f4e0a authored by Philipp Schmidt's avatar Philipp Schmidt
Browse files

Merge branch 'fix/pad-more-constants' into 'master'

Apply padding to more AGIPD constants when loading

See merge request !113
parents 997710c1 b9b26f8a
No related branches found
No related tags found
1 merge request!113Apply padding to more AGIPD constants when loading
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment