From 3a19e2a9dc98055b595f561d3bea42f474f08a79 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 21 Jun 2026 09:29:46 +0200 Subject: [PATCH] Fix Sud cooldown detection crashing the websocket on a real run get_theta_ist() can return numpy.float64 (Pot's transport delay line is a numpy array internally), so the cooldown comparison produced a numpy.bool_ instead of a plain bool. json.dumps() can't serialize that, which silently killed the websocket connection's send loop the moment a ramp step started - found by actually driving the feature through a live server+GUI run instead of only unit-style tests with a directly constructed controller. --- tasks/sud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/sud.py b/tasks/sud.py index 0f7db45..c280228 100644 --- a/tasks/sud.py +++ b/tasks/sud.py @@ -66,7 +66,10 @@ class SudTask(ATask): # its whole duration (decided once, here, rather than re-checked # every tick) instead of relying on the controller's own FSM to # notice and idle out. - cooling = ramping and ramp is not None and ramp['temp'] < self.tc.get_theta_ist() - TEMP_REACHED_TOLERANCE + # bool(...): get_theta_ist() can be a numpy.float64 (Pot's transport + # delay line is a numpy array internally) - the '<' comparison would + # then yield numpy.bool_, which json.dumps() can't serialize. + cooling = bool(ramping and ramp is not None and ramp['temp'] < self.tc.get_theta_ist() - TEMP_REACHED_TOLERANCE) self.tc.set_cooling(cooling) if step is not None: