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
73210d6a
Commit
73210d6a
authored
4 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
minor cleanup
parent
3a30e5a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
5 merge requests
!193
Release 1.4
,
!188
Release 1.4
,
!35
Oddwater od implementation
,
!34
Oddwater od implementation
,
!33
Oddwater od implementation
Pipeline
#3440
passed with stage
in 5 minutes and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/funcs/spike_detection.py
+9
-4
9 additions, 4 deletions
saqc/funcs/spike_detection.py
test/funcs/test_spike_detection.py
+2
-2
2 additions, 2 deletions
test/funcs/test_spike_detection.py
with
11 additions
and
6 deletions
saqc/funcs/spike_detection.py
+
9
−
4
View file @
73210d6a
...
...
@@ -24,6 +24,10 @@ def _stray(val_frame, partition_freq=None, partition_min=0, scoring_method='kNNM
alpha
=
0.05
):
kNNfunc
=
getattr
(
ts_ops
,
scoring_method
)
# partitioning
if
not
partition_freq
:
partition_freq
=
val_frame
.
shape
[
0
]
if
isinstance
(
partition_freq
,
str
):
partitions
=
val_frame
.
groupby
(
pd
.
Grouper
(
freq
=
partition_freq
))
else
:
...
...
@@ -31,6 +35,7 @@ def _stray(val_frame, partition_freq=None, partition_min=0, scoring_method='kNNM
grouper_series
=
grouper_series
.
transform
(
lambda
x
:
int
(
np
.
floor
(
x
/
partition_freq
)))
partitions
=
val_frame
.
groupby
(
grouper_series
)
# calculate flags for every partition
to_flag
=
[]
for
_
,
partition
in
partitions
:
if
partition
.
empty
|
(
partition
.
shape
[
0
]
<
partition_min
):
...
...
@@ -131,10 +136,10 @@ def _expFit(val_frame, scoring_method='kNNMaxGap', n_neighbors=10, iter_start=0.
return
val_frame
.
index
[
sorted_i
[
iter_index
:]]
@register
(
"
spikes_
oddWater
"
)
def
flagSpikes_
oddWater
(
data
,
field
,
flagger
,
fields
,
trafo
=
'
normScale
'
,
alpha
=
0.05
,
binning
=
'
auto
'
,
n_neighbors
=
2
,
iter_start
=
0.5
,
scoring_method
=
'
kNNMaxGap
'
,
threshing
=
'
stray
'
,
stray_partition
=
None
,
**
kwargs
):
@register
(
"
spikes_
multivariateKNNScoring
"
)
def
flagSpikes_
multivariateKNNScoring
(
data
,
field
,
flagger
,
fields
,
trafo
=
'
normScale
'
,
alpha
=
0.05
,
binning
=
'
auto
'
,
n_neighbors
=
2
,
iter_start
=
0.5
,
scoring_method
=
'
kNNMaxGap
'
,
threshing
=
'
stray
'
,
stray_partition
=
None
,
**
kwargs
):
trafo
=
composeFunction
(
trafo
.
split
(
'
,
'
))
# data fransformation/extraction
...
...
This diff is collapsed.
Click to expand it.
test/funcs/test_spike_detection.py
+
2
−
2
View file @
73210d6a
...
...
@@ -11,7 +11,7 @@ from saqc.funcs.spike_detection import (
flagSpikes_slidingZscore
,
flagSpikes_basic
,
flagSpikes_limitRaise
,
flagSpikes_
oddWater
flagSpikes_
multivariateKNNScoring
)
from
test.common
import
TESTFLAGGER
...
...
@@ -112,7 +112,7 @@ def test_flagSpikesOddWater(dat, flagger):
fields
=
[
'
data1
'
,
'
data2
'
]
data
=
pd
.
DataFrame
({
'
data1
'
:
data1
.
squeeze
(),
'
data2
'
:
data2
.
squeeze
()},
index
=
data1
.
index
)
flagger
=
flagger
.
initFlags
(
data
)
_
,
flagger_result
=
flagSpikes_
oddWater
(
_
,
flagger_result
=
flagSpikes_
multivariateKNNScoring
(
data
,
field
,
flagger
,
fields
=
fields
,
binning
=
50
,
trafo
=
'
np.log
'
,
iter_start
=
0.95
,
n_neighbors
=
10
)
...
...
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