diff --git a/test/funcs/conftest.py b/test/funcs/conftest.py index 933e4539da6b6d976a6939e2d0dffde0037cf5e8..430aaae5159d260141e73223a8cf9723f14bdba1 100644 --- a/test/funcs/conftest.py +++ b/test/funcs/conftest.py @@ -10,7 +10,8 @@ def char_dict(): return {"raise": pd.DatetimeIndex([]), "drop": pd.DatetimeIndex([]), "peak": pd.DatetimeIndex([]), - "return": pd.DatetimeIndex([])} + "return": pd.DatetimeIndex([]), + "missing": pd.DatetimeIndex([])} @pytest.fixture @@ -124,3 +125,25 @@ def course_4(char_dict): return data, char_dict return fix_funk + +@pytest.fixture +def course_5(char_dict): + # NAN_holes values , that remain on value level "base_level" and than begin exposing an outlierish or + # spikey value of magnitude "out_val" every second timestep, starting at periods/2, with the first spike. number + # periods better be even! + # periods better be greater 5 + + def fix_funk(freq='10min', periods=100, nan_slice=slice(0, None, 5), initial_level=0, final_level=10, + initial_index=pd.Timestamp(2000, 1, 1, 0, 0, 0), char_dict=char_dict): + t_index = pd.date_range(initial_index, freq=freq, periods=periods) + values = np.linspace(initial_level, final_level, periods) + s = pd.Series(values, index=t_index) + s[nan_slice] = np.nan + char_dict['missing'] = s[nan_slice].index + + data = DictOfSeries(data=s, columns=['data']) + return data, char_dict + + return fix_funk + + return fix_funk \ No newline at end of file diff --git a/test/funcs/test_proc_functions.py b/test/funcs/test_proc_functions.py new file mode 100644 index 0000000000000000000000000000000000000000..48777e7da7bfb9a0e3b8694c7e731d6399edadb9 --- /dev/null +++ b/test/funcs/test_proc_functions.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +import pytest +import numpy as np +import pandas as pd +import dios + +from saqc.funcs.proc_functions import ( + proc_interpolateMissing, + proc_resample, + proc_transform +) + +from test.common import TESTFLAGGER + +@pytest.mark.parametrize("flagger", TESTFLAGGER) +def test_interpolateMissing(course_1, flagger): + data, *_ = course_1(periods=100) + data[1] = np.nan + data[]