Commit e8f9fce8 authored by David Schäfer's avatar David Schäfer Committed by Bert Palm
Browse files

reader: fixed the loss of function names through the config interface

parent 78f6dcdd
Pipeline #46207 failed with stage
in 3 minutes and 30 seconds
......@@ -141,7 +141,7 @@ class SaQC(FuncModules):
def readConfig(self, fname):
from saqc.core.reader import readConfig
out = stdcopy.deepcopy(self)
out._to_call.extend(readConfig(fname, self._flags))
out._to_call.extend(readConfig(fname, self._flags, self._nodata))
return out
def _expandFields(self, selector: ColumnSelector, func: SaQCFunction, variables: pd.Index) -> Sequence[Tuple[ColumnSelector, SaQCFunction]]:
......@@ -178,12 +178,10 @@ class SaQC(FuncModules):
data_result, flags_result = _saqcCallFunc(sel, control, func, data, flags)
except Exception as e:
t1 = timeit.default_timer()
logger.debug(f"{} failed after {t1 - t0} sec")
_handleErrors(e, sel.field, control, func, self._error_policy)
t1 = timeit.default_timer()
logger.debug(f"{} finished after {t1 - t0} sec")
if control.plot:
......@@ -56,7 +56,7 @@ def _injectOptionalColumns(df):
return df
def _parseConfig(df, flags):
def _parseConfig(df, flags, nodata):
funcs = []
for lineno, (_, target, expr, plot) in enumerate(df.itertuples()):
if target == "None" or pd.isnull(target) or pd.isnull(expr):
......@@ -83,13 +83,13 @@ def _parseConfig(df, flags):
f = func.bind(**kwargs)
f = func.bind(**{"nodata": nodata, **kwargs})
funcs.append((selector, control, f))
return funcs
def readConfig(fname, flags):
def readConfig(fname, flags, nodata):
df = pd.read_csv(
......@@ -108,4 +108,4 @@ def readConfig(fname, flags):
df[F.TEST] = df[F.TEST].replace(r"^\s*$", np.nan, regex=True)
df[F.PLOT] = df[F.PLOT].replace({"False": "", EMPTY: "", np.nan: ""})
df = df.astype({F.PLOT: bool})
return _parseConfig(df, flags)
return _parseConfig(df, flags, nodata)
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