Skip to content
Snippets Groups Projects
Commit 48d4ae57 authored by Matthias Stefan Bodenbenner's avatar Matthias Stefan Bodenbenner
Browse files

bug fix in streaming

parent 595930b8
No related branches found
No related tags found
No related merge requests found
Pipeline #377232 passed
[![Build](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/badges/master/pipeline.svg)](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master) [![Build](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/badges/master/pipeline.svg)](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master)
# Python Unified Device Interface # Python Unified Device Interface
Current stable version: 10.0.4 Current stable version: 10.0.5
## Installation ## Installation
1. Install the WZL-UDI package via pip 1. Install the WZL-UDI package via pip
...@@ -69,7 +69,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) ...@@ -69,7 +69,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
## Recent changes ## 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 - increased logging verbosity of streaming class
- fixed streaming of semantic measurements - fixed streaming of semantic measurements
......
...@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh: ...@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read() long_description = fh.read()
setup(name='wzl-udi', setup(name='wzl-udi',
version='10.0.4', version='10.0.5',
url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python', url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python',
project_urls={ project_urls={
"Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python/-/issues", "Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python/-/issues",
......
...@@ -184,18 +184,20 @@ class UpdateJob(FixedJob): ...@@ -184,18 +184,20 @@ class UpdateJob(FixedJob):
def __init__(self, topic: str, callback: Callable): def __init__(self, topic: str, callback: Callable):
FixedJob.__init__(self, topic, 0.01, callback) FixedJob.__init__(self, topic, 0.01, callback)
self._last_value = None self._last_value = None
self._last_covariance = None
def _is_triggered(self) -> bool: def _is_triggered(self) -> bool:
value = self._callback() value, covariance = self._callback()
updated = self._last_value != value updated = self._last_value != value
self._last_value = value self._last_value = value
self._last_covariance = covariance
if isinstance(updated, list): if isinstance(updated, list):
updated = any(updated) updated = any(updated)
return updated return updated
@property @property
def value(self) -> Any: def value(self) -> Tuple[Any, Any]:
return self._last_value return self._last_value, self._last_covariance
class EventJob(FixedJob): class EventJob(FixedJob):
...@@ -211,8 +213,11 @@ class EventJob(FixedJob): ...@@ -211,8 +213,11 @@ class EventJob(FixedJob):
def _is_triggered(self) -> bool: def _is_triggered(self) -> bool:
value = self._callback() value = self._callback()
if isinstance(value, tuple):
assert len(value) == 2
value, covariance = value
updated = self._event.is_triggered(value) updated = self._event.is_triggered(value)
self._last_value = value
if isinstance(updated, list): if isinstance(updated, list):
updated = any(updated) updated = any(updated)
return updated return updated
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment