Commit d4fcf243 authored by augustin_s's avatar augustin_s 🐍
Browse files

made jitter configurable

parent f151081c
......@@ -4,15 +4,16 @@ from .adjustable import Adjustable
class DummyAdjustable(Adjustable):
def __init__(self, initial_value=0, ID="DUMMY", name="Dummy", units=None, jitter=False):
def __init__(self, initial_value=0, jitter=False, ID="DUMMY", name="Dummy", units=None):
super().__init__(ID, name=name, units=units)
self._current_value = initial_value
self._jitter = jitter
def get_current_value(self):
value = self._current_value
if self._jitter:
value += round(random(), 1)
jitter = self._jitter
if jitter:
value += plus_minus() * float(jitter)
return value
def set_target_value(self, value):
......@@ -24,3 +25,8 @@ class DummyAdjustable(Adjustable):
def plus_minus():
return 2 * random() - 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment