Skip to content
Snippets Groups Projects
Commit fc1d8818 authored by Peter Lünenschloß's avatar Peter Lünenschloß
Browse files

black/isort

parent 9ce61c19
No related branches found
No related tags found
1 merge request!600Inter limit fix
Pipeline #143727 passed with stages
in 6 minutes and 55 seconds
......@@ -213,7 +213,7 @@ class InterpolationMixin:
method: _SUPPORTED_METHODS,
order: int = 2,
limit: int | None = 2,
extrapolate: Literal['forward', 'backward', 'both'] = None,
extrapolate: Literal["forward", "backward", "both"] = None,
**kwargs,
) -> "SaQC":
"""
......
......@@ -21,6 +21,7 @@ import pandas as pd
from scipy.signal import butter, filtfilt
from scipy.stats import iqr, median_abs_deviation
from sklearn.neighbors import NearestNeighbors
from saqc.lib.tools import getFreqDelta
......@@ -351,7 +352,7 @@ def interpolateNANs(data, method, order=2, gap_limit=2, extrapolate=None):
# correction for initial gap
if isinstance(gap_limit, int):
gap_mask.iloc[:gap_limit]=True
gap_mask.iloc[:gap_limit] = True
if gap_limit == 2:
# for the common case of gap_limit=2 (default "harmonisation"), we efficiently back propagate the False
......
......@@ -208,7 +208,7 @@ def test_rateOfChange(data, expected):
),
(
2,
'backward',
"backward",
[np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan],
[0, 0, np.nan, np.nan, np.nan, 4, np.nan],
),
......@@ -226,7 +226,7 @@ def test_rateOfChange(data, expected):
),
(
3,
'forward',
"forward",
[np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan],
[np.nan, 0, np.nan, np.nan, np.nan, 4, 4],
),
......@@ -238,7 +238,7 @@ def test_rateOfChange(data, expected):
),
(
4,
'both',
"both",
[np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan],
[np.nan, 0, 1, 2, 3, 4, np.nan],
),
......@@ -251,8 +251,10 @@ def test_rateOfChange(data, expected):
],
)
def test_interpolatNANs(limit, extrapolate, data, expected):
got = interpolateNANs(pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate)
got = interpolateNANs(
pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate
)
try:
assert got.equals(pd.Series(expected, dtype=float))
except AssertionError:
print('stop')
\ No newline at end of file
print("stop")
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