diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py index aed5cba3b00fb750f87d6a2fe9f27c5bb6a9309b..51d6f5cdaefd3f069ff308317b497d91e68880d2 100644 --- a/src/calng/base_correction.py +++ b/src/calng/base_correction.py @@ -907,6 +907,12 @@ 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 a5ba784bfed16eac5bab5f1a6c9ecadea01a8e2c..c6cbc368e122b35bbbbcd198d5c3d44896d48551 100644 --- a/src/calng/base_kernel_runner.py +++ b/src/calng/base_kernel_runner.py @@ -389,6 +389,15 @@ 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 75a2032c8f77c218b789ec97c7acc2b4dc3b8639..02a502d39eecc3da8a8ba407397330c505fafa5d 100644 --- a/src/calng/corrections/AgipdCorrection.py +++ b/src/calng/corrections/AgipdCorrection.py @@ -343,6 +343,11 @@ class AgipdBaseRunner(base_kernel_runner.BaseKernelRunner): self.num_pixels_fs, ) + def extra_processing( + self, out_hash, processed_dat,a cell_table, pulse_table, gain_map + ): + out_hash["numPixelsPerGainStage"] = ... + @property def _gm_map_shape(self): return self._map_shape + (3,) # for gain-mapped constants