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

small fix

parent d52610d3
No related branches found
No related tags found
1 merge request!207small changes to get rid of #104
Pipeline #15043 passed with stage
in 6 minutes and 11 seconds
......@@ -717,8 +717,9 @@ def flagOffset(data, field, flagger, thresh, tolerance, window, numba_kickin=200
Minimum difference between to values, to consider the latter one as a spike. See condition (1)
tolerance : float, default 0
Maximum difference between pre-spike and post-spike values. See condition (2)
window : str, default '15min'
Maximum length of "spiky" value courses. See condition (3)
window : {str, int}, default '15min'
Maximum length of "spiky" value courses. See condition (3). Integer defined window length are only allowed for
regularly sampled timeseries.
numba_kickin : int, default 200000
When there are detected more than `numba_kickin` incidents of potential spikes,
the pandas.rolling - part of computation gets "jitted" with numba.
......@@ -743,6 +744,12 @@ def flagOffset(data, field, flagger, thresh, tolerance, window, numba_kickin=200
"""
dataseries = data[field].dropna()
if isinstance(window, int):
delta = getFreqDelta(dataseries.index)
if not delta:
raise TypeError('Only offset string defined window sizes allowed for irrgegularly sampled timeseries')
window = delta * window
# get all the entries preceding a significant jump
post_jumps = dataseries.diff().abs() > thresh
post_jumps = post_jumps[post_jumps]
......
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