From f299945cdaf5897119bbeb78d35088390c2c9113 Mon Sep 17 00:00:00 2001 From: ascnave <157728332+ascnave@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:55:49 +0100 Subject: [PATCH] Update _coerce_num_samples_if_fifo.py --- .../devices/digitiser/digitiser_card.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/spectrumdevice/devices/digitiser/digitiser_card.py b/src/spectrumdevice/devices/digitiser/digitiser_card.py index e173703..757563e 100644 --- a/src/spectrumdevice/devices/digitiser/digitiser_card.py +++ b/src/spectrumdevice/devices/digitiser/digitiser_card.py @@ -232,13 +232,13 @@ def set_post_trigger_length_in_samples(self, length_in_samples: int) -> None: self.write_to_spectrum_device_register(SPC_POSTTRIGGER, length_in_samples) def _coerce_num_samples_if_fifo(self, value: int) -> int: - if self.acquisition_mode == AcquisitionMode.SPC_REC_FIFO_MULTI: - if value != mod(value, get_memsize_step_size(self._model_number)): - logger.warning( - f"FIFO mode: coercing length to nearest {get_memsize_step_size(self._model_number)}" f" samples" - ) - value = int(value - mod(value, get_memsize_step_size(self._model_number))) - return value + if self.acquisition_mode == AcquisitionMode.SPC_REC_FIFO_MULTI: + if mod(value, get_memsize_step_size(self._model_number)) != 0: + logger.warning( + f"FIFO mode: coercing length to nearest {get_memsize_step_size(self._model_number)}" f" samples" + ) + value = int(value - mod(value, get_memsize_step_size(self._model_number))) + return value @property def number_of_averages(self) -> int: