From cf24bbc3c351c79a5fe1aa08ecb83c09d1ed187e Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 28 Oct 2020 09:59:40 +0100 Subject: [PATCH] improved doc on softcal and Module.registerCallback Change-Id: I12b1f7a2d29435d989fb9953f72bea181e6cb4f7 --- secop/modules.py | 13 +++++++++++++ secop_psi/softcal.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/secop/modules.py b/secop/modules.py index 63d3aae..c5c26e2 100644 --- a/secop/modules.py +++ b/secop/modules.py @@ -305,6 +305,19 @@ class Module(HasProperties, metaclass=ModuleMeta): pass def registerCallbacks(self, modobj, autoupdate=()): + """register callbacks to another module + + - whenever a self. changes: + .update_ is called with the new value as argument. + If this method raises en exception, . gets into an error state. + If the method does not exist and is in autoupdate, + . is updated to self. + - whenever . gets into an error state: + .error_update_ is called with the exception as argument. + If this method raises an error, . gets into an error state. + If the method does not exist, and . gets into the same error state as self. + """ for pname in self.parameters: errfunc = getattr(modobj, 'error_update_' + pname, None) if errfunc: diff --git a/secop_psi/softcal.py b/secop_psi/softcal.py index 7b4e405..c45cd39 100644 --- a/secop_psi/softcal.py +++ b/secop_psi/softcal.py @@ -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]))