From 886c581a9b3da8fb98bd2dbaed43b48cc9efb678 Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Tue, 18 Feb 2025 15:22:23 +0100
Subject: [PATCH] Remove hook hack

---
 src/calng/base_correction.py             | 6 ------
 src/calng/base_kernel_runner.py          | 9 ---------
 src/calng/corrections/AgipdCorrection.py | 2 +-
 3 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py
index 2d2bf6af..7f2aa23d 100644
--- a/src/calng/base_correction.py
+++ b/src/calng/base_correction.py
@@ -911,12 +911,6 @@ class BaseCorrection(PythonDevice):
                     warn_fun=warn,
                 )
 
-            # extra hook: should be refactored away
-            # maybe it's time the runner learns about hashes
-            self.kernel_runner.extra_processing(
-                data_hash, processed_buffer, cell_table, pulse_table, *additional_data
-            )
-
             for addon in self._enabled_addons:
                 addon.post_correction(
                     timestamp.getTrainId(),
diff --git a/src/calng/base_kernel_runner.py b/src/calng/base_kernel_runner.py
index c6cbc368..a5ba784b 100644
--- a/src/calng/base_kernel_runner.py
+++ b/src/calng/base_kernel_runner.py
@@ -389,15 +389,6 @@ class BaseKernelRunner:
             )
         return self._correction_applied_hash, processed_buffers[0], preview_buffers
 
-    def extra_processing(
-        self, out_hash, processed_data, cell_table, pulse_table, *additional_data
-    ):
-        """Temporary hook for doing naughty things not yet possible with addons. For
-        example, counting number of pixels in different gain stages for AGIPD. We should
-        either start passing more stuff around so addons can do this or refactor the
-        device-runner interface."""
-        pass
-
 
 kernel_dir = pathlib.Path(__file__).absolute().parent / "kernels"
 
diff --git a/src/calng/corrections/AgipdCorrection.py b/src/calng/corrections/AgipdCorrection.py
index e73f9a07..d9a5aa24 100644
--- a/src/calng/corrections/AgipdCorrection.py
+++ b/src/calng/corrections/AgipdCorrection.py
@@ -695,7 +695,7 @@ class AgipdGpuRunner(AgipdBaseRunner):
                 *additional_data,
                 *processed_buffers,
             )
-        num_frames = buffers["image.data"].shape[0]
+        # this buffer only used for this, not preview
         gain_count_buffer = self._xp.empty(
             (num_frames, 3), dtype=np.uint32
         )
-- 
GitLab