diff --git a/README.md b/README.md index f293c15c6ee137fd1ec58da6dbd705f5901a7297..eeab6ca781c2719315d1da4a6d486262417cd754 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master) # Python Unified Device Interface -Current stable version: 10.0.4 +Current stable version: 10.0.5 ## Installation 1. Install the WZL-UDI package via pip @@ -69,7 +69,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) ## Recent changes -**10.0.4** - 2024-03-21 +**10.0.5** - 2024-03-22 + - bug fix in streaming + + - **10.0.4** - 2024-03-22 - increased logging verbosity of streaming class - fixed streaming of semantic measurements diff --git a/setup.py b/setup.py index a1029db6c4e2cf3956bf042c3b09d3e1767eaa39..7470647efd68df9cd89388217fd7c749f66d8faf 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup(name='wzl-udi', - version='10.0.4', + version='10.0.5', url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python', project_urls={ "Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python/-/issues", diff --git a/src/soil/stream.py b/src/soil/stream.py index 12ab43e83af9b5c209bed7068086a52f18901502..793608e17684b9d245d7fb441a11d56b431198c3 100644 --- a/src/soil/stream.py +++ b/src/soil/stream.py @@ -184,18 +184,20 @@ class UpdateJob(FixedJob): def __init__(self, topic: str, callback: Callable): FixedJob.__init__(self, topic, 0.01, callback) self._last_value = None + self._last_covariance = None def _is_triggered(self) -> bool: - value = self._callback() + value, covariance = self._callback() updated = self._last_value != value self._last_value = value + self._last_covariance = covariance if isinstance(updated, list): updated = any(updated) return updated @property - def value(self) -> Any: - return self._last_value + def value(self) -> Tuple[Any, Any]: + return self._last_value, self._last_covariance class EventJob(FixedJob): @@ -211,8 +213,11 @@ class EventJob(FixedJob): def _is_triggered(self) -> bool: value = self._callback() + if isinstance(value, tuple): + assert len(value) == 2 + value, covariance = value + updated = self._event.is_triggered(value) - self._last_value = value if isinstance(updated, list): updated = any(updated) return updated