Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
7
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
91a5591e
Commit
91a5591e
authored
3 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
noise tools
parent
eb1a3afb
No related branches found
No related tags found
1 merge request
!256
Filter funcs
Pipeline
#22673
passed with stage
Stage: test
in 1 minute and 39 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
saqc/core/modules/noise.py
+1
-0
1 addition, 0 deletions
saqc/core/modules/noise.py
saqc/funcs/noise.py
+8
-2
8 additions, 2 deletions
saqc/funcs/noise.py
saqc/funcs/resampling.py
+1
-1
1 addition, 1 deletion
saqc/funcs/resampling.py
saqc/lib/tools.py
+15
-0
15 additions, 0 deletions
saqc/lib/tools.py
with
25 additions
and
3 deletions
saqc/core/modules/noise.py
+
1
−
0
View file @
91a5591e
...
...
@@ -13,6 +13,7 @@ from saqc.lib.types import ColumnName, FreqString, PositiveInt, PositiveFloat
class
Noise
(
ModuleBase
):
def
flagByVarianceLowPass
(
self
,
field
:
ColumnName
,
stat
:
Callable
[[
numpy
.
array
,
pd
.
Series
],
float
],
wnsz
:
FreqString
,
thresh
:
PositiveFloat
,
sub_wnsz
:
FreqString
=
None
,
...
...
This diff is collapsed.
Click to expand it.
saqc/funcs/noise.py
+
8
−
2
View file @
91a5591e
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import
pandas
as
pd
import
numpy
as
np
from
dios
import
DictOfSeries
from
typing
import
Callable
from
saqc.constants
import
*
from
saqc.core
import
register
,
Flags
from
saqc.lib.types
import
ColumnName
,
FreqString
,
PositiveInt
,
PositiveFloat
from
saqc.lib.tools
import
getAttrOrApply
@register
(
masking
=
'
field
'
,
module
=
"
noise
"
)
def
flagByVarianceLowPass
(
data
:
DictOfSeries
,
field
:
ColumnName
,
flags
:
Flags
,
stat
:
Callable
[[
np
.
array
,
pd
.
Series
],
float
],
wnsz
:
FreqString
,
thresh
:
PositiveFloat
,
sub_wnsz
:
FreqString
=
None
,
...
...
@@ -31,9 +35,11 @@ def flagByVarianceLowPass(data: DictOfSeries,
wnsz
=
pd
.
Timedelta
(
wnsz
)
sub_wnsz
=
pd
.
Timedelta
(
sub_wnsz
)
stat_parent
=
datcol
.
rolling
(
wnsz
,
min_periods
=
min_periods
).
std
()
stat_parent
=
datcol
.
rolling
(
wnsz
,
min_periods
=
min_periods
)
stat_parent
=
getAttrOrApply
(
stat_parent
,
stat
)
exceeding_parent
=
stat_parent
>
thresh
stat_sub
=
datcol
.
rolling
(
sub_wnsz
).
std
()
stat_sub
=
datcol
.
rolling
(
sub_wnsz
)
stat_sub
=
getAttrOrApply
(
stat_sub
,
stat
)
min_stat
=
stat_sub
.
rolling
(
wnsz
-
sub_wnsz
,
closed
=
'
both
'
).
min
()
exceeding_sub
=
min_stat
>
sub_thresh
...
...
This diff is collapsed.
Click to expand it.
saqc/funcs/resampling.py
+
1
−
1
View file @
91a5591e
...
...
@@ -605,7 +605,7 @@ def reindexFlags(
flags
:
Flags
,
method
:
Literal
[
"
inverse_fagg
"
,
"
inverse_bagg
"
,
"
inverse_nagg
"
,
"
inverse_fshift
"
,
"
inverse_bshift
"
,
"
inverse_nshift
"
"
inverse_fshift
"
,
"
inverse_bshift
"
,
"
inverse_nshift
"
,
"
match
"
],
source
:
str
,
freq
:
Optional
[
str
]
=
None
,
...
...
This diff is collapsed.
Click to expand it.
saqc/lib/tools.py
+
15
−
0
View file @
91a5591e
...
...
@@ -532,3 +532,18 @@ def getFreqDelta(index):
if
i
.
equals
(
index
):
return
i
[
1
]
-
i
[
0
]
return
delta
def
getAttrOrApply
(
in_obj
,
apply_obj
,
attr_access
=
'
__name__
'
,
attr_or
=
'
apply
'
):
"""
For the repeating task of applying build in (accelerated) methods/funcs (`apply_obj`),
of rolling/resampling - like objects (`in_obj`) ,
if those build-ins are available, or pass the method/func to the objects apply-like method, otherwise.
"""
try
:
out
=
getattr
(
in_obj
,
getattr
(
apply_obj
,
attr_access
))()
except
AttributeError
:
out
=
getattr
(
in_obj
,
attr_or
)(
apply_obj
)
return
out
\ No newline at end of file
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