KCL-BMEIS / spectrumdevice

Python library for communicating with digitisers manufactured by Spectrum Instrumentation
MIT License
6 stars 2 forks source link

FIFO mode: coercing length to nearest #54

Closed ascnave closed 8 months ago

ascnave commented 8 months ago

The error message FIFO mode: coercing length to nearest ... kept showing up in my case, evenso I chose the proper acquisition_length_in_samples and pre_trigger_length_in_samples. I think the problem came from the _coerce_num_samples_if_fifo, so I modified it as follow:

def _coerce_num_samples_if_fifo(self, value: int) -> int:
    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
crnbaker commented 8 months ago

Nice spot, thanks! Would you be up for creating a pull request?

crnbaker commented 8 months ago

Fixed in #55