From 05fb19e038c53622e62dd3b77f78b352285a4605 Mon Sep 17 00:00:00 2001 From: Dominic Canare Date: Thu, 8 Aug 2024 13:08:29 -0400 Subject: [PATCH 1/5] use pl-neon-recording for calibration parsing --- src/pupil_labs/realtime_api/device.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/pupil_labs/realtime_api/device.py b/src/pupil_labs/realtime_api/device.py index e3a20a5..0b636ca 100644 --- a/src/pupil_labs/realtime_api/device.py +++ b/src/pupil_labs/realtime_api/device.py @@ -23,6 +23,8 @@ parse_component, ) +from pupil_labs.neon_recording.calib import calibration_from_buffer + logger = logging.getLogger(__name__) UpdateCallbackSync = T.Callable[["pupil_labs.realtime_api.models.Component"], None] @@ -277,25 +279,7 @@ async def get_calibration(self) -> np.ndarray: raise DeviceError(response.status, "Failed to fetch calibration") raw_data = await response.read() - return np.frombuffer( - raw_data, - np.dtype( - [ - ("version", "u1"), - ("serial", "6a"), - ("scene_camera_matrix", "(3,3)d"), - ("scene_distortion_coefficients", "8d"), - ("scene_extrinsics_affine_matrix", "(4,4)d"), - ("right_camera_matrix", "(3,3)d"), - ("right_distortion_coefficients", "8d"), - ("right_extrinsics_affine_matrix", "(4,4)d"), - ("left_camera_matrix", "(3,3)d"), - ("left_distortion_coefficients", "8d"), - ("left_extrinsics_affine_matrix", "(4,4)d"), - ("crc", "u4"), - ] - ), - ) + return calibration_from_buffer(raw_data) class StatusUpdateNotifier: From d6fa9c3654189a67868390cef0b0b41f775601fd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:11:06 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pupil_labs/realtime_api/device.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pupil_labs/realtime_api/device.py b/src/pupil_labs/realtime_api/device.py index 0b636ca..afd75d9 100644 --- a/src/pupil_labs/realtime_api/device.py +++ b/src/pupil_labs/realtime_api/device.py @@ -8,6 +8,7 @@ import aiohttp import numpy as np import websockets +from pupil_labs.neon_recording.calib import calibration_from_buffer import pupil_labs # noqa: F401 @@ -23,8 +24,6 @@ parse_component, ) -from pupil_labs.neon_recording.calib import calibration_from_buffer - logger = logging.getLogger(__name__) UpdateCallbackSync = T.Callable[["pupil_labs.realtime_api.models.Component"], None] From 214a6f261eb98471b2f62528c37e02004f444874 Mon Sep 17 00:00:00 2001 From: Dominic Canare Date: Wed, 14 Aug 2024 15:55:04 -0400 Subject: [PATCH 3/5] Use new Calibration class impl --- src/pupil_labs/realtime_api/device.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pupil_labs/realtime_api/device.py b/src/pupil_labs/realtime_api/device.py index 0b636ca..369d204 100644 --- a/src/pupil_labs/realtime_api/device.py +++ b/src/pupil_labs/realtime_api/device.py @@ -23,7 +23,7 @@ parse_component, ) -from pupil_labs.neon_recording.calib import calibration_from_buffer +from pupil_labs.neon_recording.calib import Calibration logger = logging.getLogger(__name__) @@ -279,7 +279,7 @@ async def get_calibration(self) -> np.ndarray: raise DeviceError(response.status, "Failed to fetch calibration") raw_data = await response.read() - return calibration_from_buffer(raw_data) + return Calibration.from_buffer(raw_data) class StatusUpdateNotifier: From d945227f5258b674fee5baa427b2a13310dca388 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:59:24 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pupil_labs/realtime_api/device.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pupil_labs/realtime_api/device.py b/src/pupil_labs/realtime_api/device.py index 369d204..c0093c4 100644 --- a/src/pupil_labs/realtime_api/device.py +++ b/src/pupil_labs/realtime_api/device.py @@ -8,6 +8,7 @@ import aiohttp import numpy as np import websockets +from pupil_labs.neon_recording.calib import Calibration import pupil_labs # noqa: F401 @@ -23,8 +24,6 @@ parse_component, ) -from pupil_labs.neon_recording.calib import Calibration - logger = logging.getLogger(__name__) UpdateCallbackSync = T.Callable[["pupil_labs.realtime_api.models.Component"], None] From 9a200981f768560b69e335fcac555be2a5df1ca2 Mon Sep 17 00:00:00 2001 From: Dominic Canare Date: Mon, 19 Aug 2024 05:57:42 -0400 Subject: [PATCH 5/5] add min version for pl-neon-recording --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index af90637..55b9c7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ install_requires = av beaupy numpy>=1.20 - pl-neon-recording + pl-neon-recording>=0.1.4 pydantic>=2 websockets zeroconf