diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py index 6d56b2d26d6508a079f32276dd85f0be995a8076..354866889aa7c7590f6b7019b2b349d7a2d30029 100644 --- a/src/calng/base_correction.py +++ b/src/calng/base_correction.py @@ -884,6 +884,19 @@ class BaseCorrection(PythonDevice): image_data, cell_table, *additional_data ) data_hash["corrections"] = corrections + + # write previews first so addons cannot mess with them + with self.warning_context( + "processingState", WarningLampType.PREVIEW_SETTINGS + ) as warn: + self.preview_friend.write_outputs( + *previews, + timestamp=timestamp, + cell_table=cell_table, + pulse_table=pulse_table, + warn_fun=warn, + ) + for addon in self._enabled_addons: addon.post_correction( timestamp.getTrainId(), @@ -894,17 +907,6 @@ class BaseCorrection(PythonDevice): ) self.kernel_runner.reshape(processed_buffer, out=buffer_array) - with self.warning_context( - "processingState", WarningLampType.PREVIEW_SETTINGS - ) as warn: - self.preview_friend.write_outputs( - *previews, - timestamp=timestamp, - cell_table=cell_table, - pulse_table=pulse_table, - warn_fun=warn, - ) - for addon in self._enabled_addons: addon.post_reshape( timestamp.getTrainId(), buffer_array, cell_table, pulse_table, data_hash