Skip to content
Snippets Groups Projects
Commit c455fdc0 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

improved SaQC.getResult()

parent e02dcbf7
No related branches found
No related tags found
2 merge requests!193Release 1.4,!188Release 1.4
Pipeline #4880 passed with stage
in 6 minutes and 20 seconds
......@@ -119,7 +119,21 @@ class SaQC:
out = out._wrap(func, lineno=lineno, expr=expr)(**kwargs)
return out
def getResult(self):
def getResult(self, write_back=False):
""" Do the actual calculations and return the results.
Parameters
----------
write_back: bool, default False
If False, every call will recalculate, eventually plot and return the result anew.
If True the resulting data is written back in the SaQC object itself, like if
the object would have been initialized with it. Further calls will then directly
return the result with no recalculation needed, but a replotting is not possible.
Returns
-------
data, flagger: (DictOfSeries, DictOfSeries)
"""
data, flagger = self._data, self._flagger
for field, func in self._to_call:
......@@ -143,6 +157,11 @@ class SaQC:
if any([func.plot for _, func in self._to_call]):
plotAllHook(data, flagger)
if write_back:
self._data = data
self._flagger = flagger
self._to_call = []
return data, flagger
def _wrap(self, func, lineno=None, expr=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment