Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix _send_temperatures() for Seneca device
As the Seneca device now returns its temperatures as a numpy array, unfortunately the _send_temperatures() function no longer works with it: ``` Traceback (most recent call last): File "/home/alex/code/FINESSE/finesse/gui/temp_control.py", line 265, in _poll_dp9800 pub.sendMessage(f"device.{TEMPERATURE_MONITOR_TOPIC}.data.request") File "/home/alex/code/FINESSE/.venv/lib/python3.11/site-packages/pubsub/core/publisher.py", line 216, in sendMessage topicObj.publish(**msgData) File "/home/alex/code/FINESSE/.venv/lib/python3.11/site-packages/pubsub/core/topicobj.py", line 452, in publish self.__sendMessage(msgData, topicObj, msgDataSubset) File "/home/alex/code/FINESSE/.venv/lib/python3.11/site-packages/pubsub/core/topicobj.py", line 482, in __sendMessage listener(data, self, allData) File "/home/alex/code/FINESSE/.venv/lib/python3.11/site-packages/pubsub/core/listener.py", line 237, in __call__ cb(**kwargs) File "/home/alex/code/FINESSE/finesse/hardware/__init__.py", line 47, in _send_temperatures temperatures = _try_get_temperatures() or _DEFAULT_TEMPS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ``` Seemingly unlike Python's built-in collections, you can't check whether a numpy array is empty by looking at its "truthiness". Fix by using an explicit if-statement.
- Loading branch information