From b182ea42a1e88f585d19e81d0acb452904247d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Wed, 18 Sep 2024 14:41:10 +0000 Subject: [PATCH] Truncate ion pump pressure to 2 decimals --- src/lvmcryo/__main__.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lvmcryo/__main__.py b/src/lvmcryo/__main__.py index 2732242..79e3cbb 100644 --- a/src/lvmcryo/__main__.py +++ b/src/lvmcryo/__main__.py @@ -10,6 +10,7 @@ import asyncio import json +import math import pathlib import signal import warnings @@ -690,13 +691,18 @@ async def ion( f"{', '.join(failed_cameras)}" ) - status = { - camera: data - for camera, data in status.items() - if camera not in failed_cameras - } - - info_console.print(status, width=80) + status_pretty = {} + for camera, data in status.items(): + if camera not in failed_cameras: + pressure = data["pressure"] + status_pretty[camera] = { + "pressure": float(f"{pressure:.2e}") # Truncate to 2 decimals + if pressure is not None + else math.nan, + "on": data["on"], + } + + info_console.print(status_pretty, width=80) return error: bool = False