diff --git a/src/calng/corrections/AgipdCorrection.py b/src/calng/corrections/AgipdCorrection.py index 0bd3daf307e49b046e67ce37238d3a4145515774..212462f863a21e0424dc7a51f0e236530b6dfc7e 100644 --- a/src/calng/corrections/AgipdCorrection.py +++ b/src/calng/corrections/AgipdCorrection.py @@ -775,13 +775,11 @@ class AgipdCorrection(base_correction.BaseCorrection): self.log_status_warn(f"Unknown exception when loading data to GPU: {e}") buffer_handle, buffer_array = self._shmem_buffer.next_slot() - self.kernel_runner.correct(self._correction_flag_enabled) - # previews are generated before any addons are run + # first prepare previews (not affected by addons) + self.kernel_runner.correct(self._correction_flag_preview) with self.warning_context( "processingState", base_correction.WarningLampType.PREVIEW_SETTINGS ) as warn: - if self._correction_flag_enabled != self._correction_flag_preview: - self.kernel_runner.correct(self._correction_flag_preview) ( preview_slice_index, preview_cell, @@ -800,6 +798,11 @@ class AgipdCorrection(base_correction.BaseCorrection): preview_raw_gain, preview_gain_map, ) = self.kernel_runner.compute_previews(preview_slice_index) + # TODO: start writing out previews asynchronously in the background + + # then prepare full corrected data + if self._correction_flag_enabled != self._correction_flag_preview: + 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