From c393d584c5ef3c108d2b325e1d501bfe7db4b45b Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Fri, 6 Sep 2024 00:30:36 +0200 Subject: [PATCH] fix mypy errors and avoid copy --- src/seabreeze/pyseabreeze/features/spectrometer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/seabreeze/pyseabreeze/features/spectrometer.py b/src/seabreeze/pyseabreeze/features/spectrometer.py index 7739170..037b0ec 100644 --- a/src/seabreeze/pyseabreeze/features/spectrometer.py +++ b/src/seabreeze/pyseabreeze/features/spectrometer.py @@ -745,7 +745,7 @@ class SeaBreezeSpectrometerFeatureHR4(SeaBreezeSpectrometerFeatureOBP2): class SeaBreezeSpectrometerFeatureFX(SeaBreezeSpectrometerFeatureOBP): - def _get_spectrum_raw(self): + def _get_spectrum_raw(self) -> NDArray[np.uint8]: timeout = int( self._integration_time_max * 1e-3 + self.protocol.transport.default_timeout_ms @@ -753,4 +753,4 @@ def _get_spectrum_raw(self): # the message type is different than the default defined in the protocol, # requires addition of a new message type in protocol to work datastring = self.protocol.query(0x00101000, timeout_ms=timeout) - return numpy.fromstring(datastring, dtype=numpy.uint8) + return numpy.frombuffer(datastring, dtype=numpy.uint8)