From cf20dc7483cd59e7387939ed9a0ef4a61fb400db Mon Sep 17 00:00:00 2001 From: David Hammer <dhammer@mailbox.org> Date: Tue, 11 Jan 2022 14:45:43 +0100 Subject: [PATCH] Make _update_frame_filter by default call _update_buffers itself --- src/calng/base_correction.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py index 28d59130..59c48000 100644 --- a/src/calng/base_correction.py +++ b/src/calng/base_correction.py @@ -639,7 +639,6 @@ class BaseCorrection(PythonDevice): self, pathlib.Path.cwd() / "calibration-client-secrets.json" ) self._update_frame_filter() - self._update_buffers() self._buffered_status_update = Hash( "trainId", @@ -825,9 +824,9 @@ class BaseCorrection(PythonDevice): self.log.DEBUG(f"Corrections for dataOutput: {str(enabled)}") self.log.DEBUG(f"Corrections for preview: {str(preview)}") - def _update_frame_filter(self): + def _update_frame_filter(self, update_buffers=True): """Parse frameFilter string (if set) and update cached filter array. May update - dataFormat.filteredFrames, so one will typically want to call _update_buffers + dataFormat.filteredFrames - will therefore by default call _update_buffers afterwards.""" # TODO: add some validation to preReconfigure self.log.DEBUG("Updating frame filter") @@ -871,6 +870,9 @@ class BaseCorrection(PythonDevice): ): self.log_status_warn("Invalid frame filter set, expect exceptions!") + if update_buffers: + self._update_buffers() + def _update_buffers(self): """(Re)initialize buffers / kernel runner according to expected data shapes""" self.log.INFO("Updating buffers according to data shapes") @@ -973,7 +975,6 @@ class BaseCorrection(PythonDevice): self.set("dataFormat.memoryCells", image_data.shape[0]) with self._buffer_lock: self._update_frame_filter() - self._update_buffers() # DataAggregator typically tells us the wrong axis order if self._schema_cache["dataFormat.overrideInputAxisOrder"]: -- GitLab