diff --git a/src/calng/corrections/AgipdCorrection.py b/src/calng/corrections/AgipdCorrection.py index 2765209a8516e06ec4153ac59704b3e2b7f038db..0bd3daf307e49b046e67ce37238d3a4145515774 100644 --- a/src/calng/corrections/AgipdCorrection.py +++ b/src/calng/corrections/AgipdCorrection.py @@ -776,19 +776,7 @@ class AgipdCorrection(base_correction.BaseCorrection): buffer_handle, buffer_array = self._shmem_buffer.next_slot() self.kernel_runner.correct(self._correction_flag_enabled) - for addon in self._enabled_addons: - addon.post_correction( - self.kernel_runner.processed_data, cell_table, pulse_table, data_hash - ) - self.kernel_runner.reshape( - output_order=self.unsafe_get("dataFormat.outputAxisOrder"), - out=buffer_array, - ) - for addon in self._enabled_addons: - addon.post_reshape( - buffer_array, cell_table, pulse_table, data_hash - ) - # after reshape, data for dataOutput is now safe in its own buffer + # previews are generated before any addons are run with self.warning_context( "processingState", base_correction.WarningLampType.PREVIEW_SETTINGS ) as warn: @@ -812,6 +800,18 @@ class AgipdCorrection(base_correction.BaseCorrection): preview_raw_gain, preview_gain_map, ) = self.kernel_runner.compute_previews(preview_slice_index) + for addon in self._enabled_addons: + addon.post_correction( + self.kernel_runner.processed_data, cell_table, pulse_table, data_hash + ) + self.kernel_runner.reshape( + output_order=self.unsafe_get("dataFormat.outputAxisOrder"), + out=buffer_array, + ) + for addon in self._enabled_addons: + addon.post_reshape( + buffer_array, cell_table, pulse_table, data_hash + ) # reusing input data hash for sending if self._use_shmem_handles: