Skip to content

Commit

Permalink
Truncate ion pump pressure to 2 decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 18, 2024
1 parent cd4c812 commit b182ea4
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/lvmcryo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import asyncio
import json
import math
import pathlib
import signal
import warnings
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b182ea4

Please sign in to comment.