Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
496ae7e0
Commit
496ae7e0
authored
4 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
breaks: type hints
parent
03ea2784
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/breaks.py
+13
-10
13 additions, 10 deletions
saqc/funcs/breaks.py
with
13 additions
and
10 deletions
saqc/funcs/breaks.py
+
13
−
10
View file @
496ae7e0
...
...
@@ -2,18 +2,20 @@
# -*- coding: utf-8 -*-
import
dio
s
from
dios
import
DictOfSerie
s
import
numpy
as
np
import
pandas
as
pd
from
typing
import
Tuple
from
saqc.lib.tools
import
groupConsecutives
from
saqc.funcs.changepoints
import
assignChangePointCluster
from
saqc.core.register
import
register
from
saqc.flagger.baseflagger
import
BaseFlagger
@register
(
masking
=
'
field
'
)
def
flagMissing
(
data
,
field
,
flagger
,
nodata
=
np
.
nan
,
**
kwargs
):
def
flagMissing
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
nodata
:
float
=
np
.
nan
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]
:
"""
The function flags all values indicating missing data.
...
...
@@ -48,7 +50,7 @@ def flagMissing(data, field, flagger, nodata=np.nan, **kwargs):
@register
(
masking
=
'
field
'
)
def
flagIsolated
(
data
,
field
,
flagger
,
gap_window
,
group_window
,
**
kwargs
):
def
flagIsolated
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
gap_window
:
str
,
group_window
:
str
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]
:
"""
The function flags arbitrary large groups of values, if they are surrounded by sufficiently
large data gaps. A gap is defined as group of missing and/or flagged values.
...
...
@@ -68,10 +70,10 @@ def flagIsolated(data, field, flagger, gap_window, group_window, **kwargs):
The fieldname of the column, holding the data-to-be-flagged.
flagger : saqc.flagger.BaseFlagger
A flagger object, holding flags and additional informations related to `data`.
gap_window :
gap_window :
str
The minimum size of the gap before and after a group of valid values, making this group considered an
isolated group. See condition (2) and (3)
group_window :
group_window :
str
The maximum temporal extension allowed for a group that is isolated by gaps of size
'
gap_window
'
,
to be actually flagged as isolated group. See condition (1).
...
...
@@ -108,7 +110,8 @@ def flagIsolated(data, field, flagger, gap_window, group_window, **kwargs):
@register
(
masking
=
'
field
'
)
def
flagJumps
(
data
,
field
,
flagger
,
thresh
,
winsz
,
min_periods
=
1
,
**
kwargs
):
def
flagJumps
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
thresh
:
float
,
winsz
:
str
,
min_periods
:
int
=
1
,
**
kwargs
):
"""
Flag datapoints, where the mean of the values significantly changes (where the value course
"
jumps
"
).
...
...
@@ -125,7 +128,7 @@ def flagJumps(data, field, flagger, thresh, winsz, min_periods=1, **kwargs):
winsz : str
The temporal extension, of the rolling windows, the mean values that are to be compared,
are obtained from.
min_periods :
{str, int}
min_periods :
int, default 1
Minimum number of periods that have to be present in a window of size `winsz`, so that
the mean value obtained from that window is regarded valid.
"""
...
...
@@ -136,8 +139,8 @@ def flagJumps(data, field, flagger, thresh, winsz, min_periods=1, **kwargs):
bwd_window
=
winsz
,
min_periods_bwd
=
min_periods
,
flag_changepoints
=
True
,
_
model_by_resids
=
False
,
_
assign_cluster
=
False
,
model_by_resids
=
False
,
assign_cluster
=
False
,
**
kwargs
)
return
data
,
flagger
\ No newline at end of file
return
data
,
flagger
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment