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
8eae4b96
Commit
8eae4b96
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
fixed curvefit.py and rolling.py
parent
ad8703c6
No related branches found
No related tags found
4 merge requests
!271
Static expansion of regular expressions
,
!260
Follow-Up Translations
,
!237
Flagger Translations
,
!232
WIP: Fuzzy testing
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/funcs/curvefit.py
+7
-10
7 additions, 10 deletions
saqc/funcs/curvefit.py
saqc/funcs/rolling.py
+5
-9
5 additions, 9 deletions
saqc/funcs/rolling.py
with
12 additions
and
19 deletions
saqc/funcs/curvefit.py
+
7
−
10
View file @
8eae4b96
...
@@ -18,7 +18,6 @@ from saqc.flagger import Flagger
...
@@ -18,7 +18,6 @@ from saqc.flagger import Flagger
from
saqc.lib.ts_operators
import
polyRollerIrregular
,
polyRollerNumba
,
polyRoller
,
polyRollerNoMissingNumba
,
polyRollerNoMissing
from
saqc.lib.ts_operators
import
polyRollerIrregular
,
polyRollerNumba
,
polyRoller
,
polyRollerNoMissingNumba
,
polyRollerNoMissing
@register
(
masking
=
'
field
'
,
module
=
"
curvefit
"
)
@register
(
masking
=
'
field
'
,
module
=
"
curvefit
"
)
def
fitPolynomial
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
Flagger
,
def
fitPolynomial
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
Flagger
,
winsz
:
Union
[
int
,
str
],
winsz
:
Union
[
int
,
str
],
...
@@ -103,11 +102,11 @@ def fitPolynomial(data: DictOfSeries, field: str, flagger: Flagger,
...
@@ -103,11 +102,11 @@ def fitPolynomial(data: DictOfSeries, field: str, flagger: Flagger,
Flags values may have changed relatively to the flagger input.
Flags values may have changed relatively to the flagger input.
"""
"""
# todo: some (rater large) parts are functional similar to saqc.funcs.rolling.roll
if
data
[
field
].
empty
:
if
data
[
field
].
empty
:
return
data
,
flagger
return
data
,
flagger
data
=
data
.
copy
()
data
=
data
.
copy
()
to_fit
=
data
[
field
]
to_fit
=
data
[
field
]
flags
=
flagger
.
getFlags
(
field
)
regular
=
getFreqDelta
(
to_fit
.
index
)
regular
=
getFreqDelta
(
to_fit
.
index
)
if
not
regular
:
if
not
regular
:
if
isinstance
(
winsz
,
int
):
if
isinstance
(
winsz
,
int
):
...
@@ -194,13 +193,11 @@ def fitPolynomial(data: DictOfSeries, field: str, flagger: Flagger,
...
@@ -194,13 +193,11 @@ def fitPolynomial(data: DictOfSeries, field: str, flagger: Flagger,
data
[
field
]
=
residues
data
[
field
]
=
residues
if
eval_flags
:
if
eval_flags
:
num_cats
,
codes
=
flags
.
factorize
()
# with the new flagger we dont have to care
num_cats
=
pd
.
Series
(
num_cats
,
index
=
flags
.
index
).
rolling
(
winsz
,
center
=
True
,
min_periods
=
min_periods
).
max
()
# about to set NaNs to the original flags anymore
nan_samples
=
num_cats
[
num_cats
.
isna
()]
# todo: we does not get any flags here, because of masking=field
num_cats
.
drop
(
nan_samples
.
index
,
inplace
=
True
)
worst
=
flagger
[
field
].
rolling
(
winsz
,
center
=
True
,
min_periods
=
min_periods
).
max
()
to_flag
=
pd
.
Series
(
codes
[
num_cats
.
astype
(
int
)],
index
=
num_cats
.
index
)
flagger
[
field
]
=
worst
to_flag
=
to_flag
.
align
(
nan_samples
)[
0
]
to_flag
[
nan_samples
.
index
]
=
flags
[
nan_samples
.
index
]
flagger
=
flagger
.
setFlags
(
field
,
to_flag
.
values
,
**
kwargs
)
return
data
,
flagger
return
data
,
flagger
This diff is collapsed.
Click to expand it.
saqc/funcs/rolling.py
+
5
−
9
View file @
8eae4b96
...
@@ -72,7 +72,6 @@ def roll(
...
@@ -72,7 +72,6 @@ def roll(
data
=
data
.
copy
()
data
=
data
.
copy
()
to_fit
=
data
[
field
]
to_fit
=
data
[
field
]
flags
=
flagger
.
getFlags
(
field
)
if
to_fit
.
empty
:
if
to_fit
.
empty
:
return
data
,
flagger
return
data
,
flagger
...
@@ -123,13 +122,10 @@ def roll(
...
@@ -123,13 +122,10 @@ def roll(
data
[
field
]
=
means
data
[
field
]
=
means
if
eval_flags
:
if
eval_flags
:
num_cats
,
codes
=
flags
.
factorize
()
# with the new flagger we dont have to care
num_cats
=
pd
.
Series
(
num_cats
,
index
=
flags
.
index
).
rolling
(
winsz
,
center
=
True
,
min_periods
=
min_periods
).
max
()
# about to set NaNs to the original flags anymore
nan_samples
=
num_cats
[
num_cats
.
isna
()]
# todo: we does not get any flags here, because of masking=field
num_cats
.
drop
(
nan_samples
.
index
,
inplace
=
True
)
worst
=
flagger
[
field
].
rolling
(
winsz
,
center
=
True
,
min_periods
=
min_periods
).
max
()
to_flag
=
pd
.
Series
(
codes
[
num_cats
.
astype
(
int
)],
index
=
num_cats
.
index
)
flagger
[
field
]
=
worst
to_flag
=
to_flag
.
align
(
nan_samples
)[
0
]
to_flag
[
nan_samples
.
index
]
=
flags
[
nan_samples
.
index
]
flagger
=
flagger
.
setFlags
(
field
,
to_flag
.
values
,
**
kwargs
)
return
data
,
flagger
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