improved doc on softcal and Module.registerCallback

Change-Id: I12b1f7a2d29435d989fb9953f72bea181e6cb4f7
This commit is contained in:
zolliker 2020-10-28 09:59:40 +01:00
parent 29c66fa19a
commit cf24bbc3c3
2 changed files with 14 additions and 1 deletions

View File

@ -305,6 +305,19 @@ class Module(HasProperties, metaclass=ModuleMeta):
pass
def registerCallbacks(self, modobj, autoupdate=()):
"""register callbacks to another module <modobj>
- whenever a self.<param> changes:
<modobj>.update_<param> is called with the new value as argument.
If this method raises en exception, <modobj>.<param> gets into an error state.
If the method does not exist and <param> is in autoupdate,
<modobj>.<param> is updated to self.<param>
- whenever <self>.<param> gets into an error state:
<modobj>.error_update_<param> is called with the exception as argument.
If this method raises an error, <modobj>.<param> gets into an error state.
If the method does not exist, and <param is in autoupdate,
<modobj>.<param> gets into the same error state as self.<param>
"""
for pname in self.parameters:
errfunc = getattr(modobj, 'error_update_' + pname, None)
if errfunc:

View File

@ -51,7 +51,7 @@ class StdParser:
self.xdata, self.ydata = [], []
def parse(self, line):
"""get numbers from a line and put them to self.output"""
"""get numbers from a line and put them to self.xdata / self.ydata"""
row = line.split()
try:
self.xdata.append(float(row[self.xcol]))