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

test implemented/minor bfx

parent 48eeddf8
No related branches found
No related tags found
1 merge request!256Filter funcs
......@@ -148,8 +148,8 @@ def flagByVariance(
lambda x: varQC(x, max_missing, max_consec_missing),
window,
thresh,
min_periods=min_periods,
comparator=operator.lt,
operator.lt,
min_periods=min_periods
)
flags[to_set[to_set].index, field] = flag
......
......@@ -59,19 +59,22 @@ def flagByStatLowPass(
datcol = data[field]
if not min_periods:
min_periods = 0
if not sub_thresh:
sub_thresh = thresh
winsz = pd.Timedelta(winsz)
if sub_winsz:
sub_winsz = pd.Timedelta(sub_winsz)
to_set = statPass(
datcol,
stat,
winsz,
thresh,
operator.gt,
sub_winsz,
sub_thresh,
min_periods,
comparator=operator.gt,
min_periods
)
flags[to_set[to_set].index, field] = flag
return data, flags
......@@ -2,7 +2,10 @@
# -*- coding: utf-8 -*-
import dios
import pandas as pd
import numpy as np
from saqc.funcs.noise import flagByStatLowPass
from saqc.constants import *
from saqc.core import initFlagsLike
from saqc.funcs.drift import (
......@@ -30,6 +33,18 @@ def field(data):
return data.columns[0]
def test_statPass():
data = pd.Series(0, index=pd.date_range('2000','2001',freq='1D'), name='data')
noise = [-1, 1] * 10
data[100:120] = noise
data[200:210] = noise[:10]
data = dios.DictOfSeries(data)
flags = initFlagsLike(data)
data, flags = flagByStatLowPass(data, 'data', flags, np.std, '20D', 0.999, '5D', 0.999, 0, flag=BAD)
assert (flags['data'] == BAD).sum() == 21
assert (flags['data'][200:210] < BAD).all()
def test_flagRange(data, field):
min, max = 10, 90
flags = initFlagsLike(data)
......
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