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
81a891d2
Commit
81a891d2
authored
4 years ago
by
David Schäfer
Browse files
Options
Downloads
Plain Diff
Merge branch 'residues' into 'develop'
residues: type hints See merge request
!200
parents
cf2a1d10
275b6cd9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!200
residues: type hints
Pipeline
#14403
passed with warnings with stages
in 12 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/residues.py
+25
-7
25 additions, 7 deletions
saqc/funcs/residues.py
with
25 additions
and
7 deletions
saqc/funcs/residues.py
+
25
−
7
View file @
81a891d2
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from
typing
import
Tuple
,
Union
,
Optional
,
Callable
from
typing_extensions
import
Literal
import
numpy
as
np
from
dios
import
DictOfSeries
from
saqc.core.register
import
register
from
saqc.flagger.baseflagger
import
BaseFlagger
from
saqc.funcs.rolling
import
roll
from
saqc.funcs.curvefit
import
fitPolynomial
@register
(
masking
=
'
field
'
)
def
calculatePolynomialResidues
(
data
,
field
,
flagger
,
winsz
,
polydeg
,
numba
=
"
auto
"
,
eval_flags
=
True
,
min_periods
=
0
,
**
kwargs
):
def
calculatePolynomialResidues
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
winsz
:
Union
[
str
,
int
],
polydeg
:
int
,
numba
:
Literal
[
True
,
False
,
"
auto
"
]
=
"
auto
"
,
eval_flags
:
bool
=
True
,
min_periods
:
Optional
[
int
]
=
0
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]:
"""
Function fits a polynomial model to the data and returns the residues.
...
...
@@ -67,7 +79,7 @@ def calculatePolynomialResidues(data, field, flagger, winsz, polydeg, numba="aut
eval_flags : bool, default True
Wheather or not to assign new flags to the calculated residuals. If True, a residual gets assigned the worst
flag present in the interval, the data for its calculation was obtained from.
min_periods : {int,
np.nan
}, default 0
min_periods : {int,
None
}, default 0
The minimum number of periods, that has to be available in every values fitting surrounding for the polynomial
fit to be performed. If there are not enough values, np.nan gets assigned. Default (0) results in fitting
regardless of the number of values present (results in overfitting for too sparse intervals). To automatically
...
...
@@ -84,16 +96,22 @@ def calculatePolynomialResidues(data, field, flagger, winsz, polydeg, numba="aut
"""
data
,
flagger
=
fitPolynomial
(
data
,
field
,
flagger
,
winsz
,
polydeg
,
numba
=
numba
,
eval_flags
=
eval_flags
,
min_periods
=
min_periods
,
_
return_residues
=
True
,
**
kwargs
)
min_periods
=
min_periods
,
return_residues
=
True
,
**
kwargs
)
return
data
,
flagger
@register
(
masking
=
'
field
'
)
def
calculateRollingResidues
(
data
,
field
,
flagger
,
winsz
,
func
=
np
.
mean
,
eval_flags
=
True
,
min_periods
=
0
,
center
=
True
,
**
kwargs
):
def
calculateRollingResidues
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
winsz
:
Union
[
str
,
int
],
func
:
Callable
[[
np
.
array
],
np
.
array
]
=
np
.
mean
,
eval_flags
:
bool
=
True
,
min_periods
:
Optional
[
int
]
=
0
,
center
:
bool
=
True
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]:
data
,
flagger
=
roll
(
data
,
field
,
flagger
,
winsz
,
func
=
func
,
eval_flags
=
eval_flags
,
min_periods
=
min_periods
,
center
=
center
,
_return_residues
=
True
,
**
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