From ba181ccfa6e57bf08b25265a11c33dd0705355b5 Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Wed, 26 Jan 2022 21:19:05 +0100
Subject: [PATCH] Better empty cell table detection

---
 src/calng/base_correction.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py
index 1697f568..33f208a6 100644
--- a/src/calng/base_correction.py
+++ b/src/calng/base_correction.py
@@ -956,12 +956,13 @@ class BaseCorrection(PythonDevice):
                 return
 
             train_id = metadata.getAttribute("timestamp", "tid")
-            cell_table = np.squeeze(data_hash.get(self._cell_table_path))
-            if len(cell_table.shape) == 0 and int(cell_table) == 0:
+            cell_table = data_hash.get(self._cell_table_path)
+            if cell_table.size == 0:
                 self.log_status_warn(
-                    "cellId had 0 dimensions. DAQ may not be sending data."
+                    "Empty cell table, DAQ probably not sending data."
                 )
                 return
+            cell_table = np.squeeze(cell_table)
 
             # no more common reasons to skip input, so go to processing
             if state is State.ON:
-- 
GitLab