From bfa930e35d253ec81f01b5a42fee3d14a658c03f Mon Sep 17 00:00:00 2001 From: Bert Palm <bert.palm@ufz.de> Date: Thu, 25 Mar 2021 16:14:23 +0100 Subject: [PATCH] killed some snakes, hiding in the forest of saqc --- saqc/__main__.py | 4 ++-- saqc/flagger/flags.py | 2 +- saqc/flagger/history.py | 16 ++++++++-------- saqc/funcs/drift.py | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/saqc/__main__.py b/saqc/__main__.py index b878c8237..8fbb3cb7c 100644 --- a/saqc/__main__.py +++ b/saqc/__main__.py @@ -27,7 +27,7 @@ SCHEMES = { } -def _setup_logging(loglvl): +def _setupLogging(loglvl): logger.setLevel(loglvl) handler = logging.StreamHandler() formatter = logging.Formatter("[%(asctime)s][%(name)s][%(levelname)s]: %(message)s") @@ -85,7 +85,7 @@ def main(config, data, flagger, outfile, nodata, log_level, fail): if SCHEMES[flagger] is NotImplemented: warnings.warn("flagger is currently not supported") - _setup_logging(log_level) + _setupLogging(log_level) reader, writer = setupIO(nodata) data = readData(reader, data) diff --git a/saqc/flagger/flags.py b/saqc/flagger/flags.py index 11e5f598f..63d3a505f 100644 --- a/saqc/flagger/flags.py +++ b/saqc/flagger/flags.py @@ -40,7 +40,7 @@ class _HistAccess: if not isinstance(value, History): raise TypeError("Not a History") - History._validate_hist_with_mask(value.hist, value.mask) + History._validateHistWithMask(value.hist, value.mask) self.obj._data[key] = value self.obj._cache.pop(key, None) diff --git a/saqc/flagger/history.py b/saqc/flagger/history.py index e5220ddda..8ac0552a7 100644 --- a/saqc/flagger/history.py +++ b/saqc/flagger/history.py @@ -65,11 +65,11 @@ class History: raise ValueError("Cannot take 'mask' without 'hist'") elif hist is not None and mask is None: - hist = self._validate_hist(hist) + hist = self._validateHist(hist) mask = pd.DataFrame(True, index=hist.index, columns=hist.columns) else: - hist, mask = self._validate_hist_with_mask(hist, mask) + hist, mask = self._validateHistWithMask(hist, mask) if copy: hist = hist.copy() @@ -207,7 +207,7 @@ class History: if isinstance(value, History): return self._appendHistory(value, force=force) - value = self._validate_value(value) + value = self._validateValue(value) if len(self) > 0 and not value.index.equals(self.index): raise ValueError("Index must be equal to history index") @@ -239,7 +239,7 @@ class History: ----- This ignores the column names of the passed History. """ - self._validate_hist_with_mask(value.hist, value.mask) + self._validateHistWithMask(value.hist, value.mask) if len(self) > 0 and not value.index.equals(self.index): raise ValueError("Index must be equal to history index") @@ -394,13 +394,13 @@ class History: # @staticmethod - def _validate_hist_with_mask(obj: pd.DataFrame, mask: pd.DataFrame) -> Tuple[pd.DataFrame, pd.DataFrame]: + def _validateHistWithMask(obj: pd.DataFrame, mask: pd.DataFrame) -> Tuple[pd.DataFrame, pd.DataFrame]: """ check type, columns, index, dtype and if the mask fits the obj. """ # check hist - History._validate_hist(obj) + History._validateHist(obj) # check mask if not isinstance(mask, pd.DataFrame): @@ -422,7 +422,7 @@ class History: return obj, mask @staticmethod - def _validate_hist(obj: pd.DataFrame) -> pd.DataFrame: + def _validateHist(obj: pd.DataFrame) -> pd.DataFrame: """ check type, columns, dtype of obj. """ @@ -442,7 +442,7 @@ class History: return obj @staticmethod - def _validate_value(obj: pd.Series) -> pd.Series: + def _validateValue(obj: pd.Series) -> pd.Series: """ index is not checked ! """ diff --git a/saqc/funcs/drift.py b/saqc/funcs/drift.py index d8605f67d..2dd2fe7c4 100644 --- a/saqc/funcs/drift.py +++ b/saqc/funcs/drift.py @@ -433,7 +433,7 @@ def correctExponentialDrift( for k, group in drift_grouper: dataSeries = group[to_correct.name] - dataFit, dataShiftTarget = _drift_fit(dataSeries, shift_targets.loc[k, :][0], cal_mean) + dataFit, dataShiftTarget = _driftFit(dataSeries, shift_targets.loc[k, :][0], cal_mean) dataFit = pd.Series(dataFit, index=group.index) dataShiftTarget = pd.Series(dataShiftTarget, index=group.index) dataShiftVektor = dataShiftTarget - dataFit @@ -628,7 +628,7 @@ def correctOffset( return data, flagger -def _drift_fit(x, shift_target, cal_mean): +def _driftFit(x, shift_target, cal_mean): x_index = x.index - x.index[0] x_data = x_index.total_seconds().values x_data = x_data / x_data[-1] -- GitLab