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
bac2aaec
Commit
bac2aaec
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
adjusted saqc calls to customRoller
parent
cfcb20a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!193
Release 1.4
,
!188
Release 1.4
,
!166
Rolling rework fixes
Pipeline
#11699
passed with stage
in 6 minutes and 11 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
saqc/funcs/constants_detection.py
+1
-1
1 addition, 1 deletion
saqc/funcs/constants_detection.py
saqc/funcs/modelling.py
+5
-7
5 additions, 7 deletions
saqc/funcs/modelling.py
saqc/lib/rolling.py
+3
-3
3 additions, 3 deletions
saqc/lib/rolling.py
with
9 additions
and
11 deletions
saqc/funcs/constants_detection.py
+
1
−
1
View file @
bac2aaec
...
...
@@ -50,7 +50,7 @@ def constants_flagBasic(data, field, flagger, thresh, window, **kwargs):
# min_periods=2 ensures that at least two non-nan values are present
# in each window and also min() == max() == d[i] is not possible.
kws
=
dict
(
window
=
window
,
min_periods
=
2
)
kws
=
dict
(
window
=
window
,
min_periods
=
2
,
expand
=
False
)
# find all consecutive constant values in one direction...
r
=
customRoller
(
d
,
**
kws
)
...
...
This diff is collapsed.
Click to expand it.
saqc/funcs/modelling.py
+
5
−
7
View file @
bac2aaec
...
...
@@ -512,13 +512,11 @@ def modelling_changePointCluster(data, field, flagger, stat_func, thresh_func, b
if
reduce_window
is
None
:
reduce_window
=
f
"
{
int
(
pd
.
Timedelta
(
bwd_window
).
total_seconds
()
+
pd
.
Timedelta
(
fwd_window
).
total_seconds
())
}
s
"
# native pandas.rolling also fails
data_ser
.
rolling
(
window
=
bwd_window
,
min_periods
=
min_periods_bwd
,
closed
=
closed
)
roller
=
customRoller
(
data_ser
,
window
=
bwd_window
,
min_periods
=
min_periods_bwd
,
closed
=
closed
)
bwd_start
,
bwd_end
=
roller
.
window
.
get_window_bounds
()
roller
=
customRoller
(
data_ser
,
window
=
bwd_window
)
bwd_start
,
bwd_end
=
roller
.
window
.
get_window_bounds
(
len
(
data_ser
),
min_periods
=
min_periods_bwd
,
closed
=
closed
)
roller
=
customRoller
(
data_ser
,
window
=
fwd_window
,
min_periods
=
min_periods_fwd
,
closed
=
closed
,
forward
=
True
)
fwd_start
,
fwd_end
=
roller
.
window
.
get_window_bounds
()
roller
=
customRoller
(
data_ser
,
window
=
fwd_window
,
forward
=
True
)
fwd_start
,
fwd_end
=
roller
.
window
.
get_window_bounds
(
len
(
data_ser
),
min_periods
=
min_periods_fwd
,
closed
=
closed
)
min_mask
=
~
((
fwd_end
-
fwd_start
<=
min_periods_fwd
)
|
(
bwd_end
-
bwd_start
<=
min_periods_bwd
))
fwd_end
=
fwd_end
[
min_mask
]
...
...
@@ -560,7 +558,7 @@ def modelling_changePointCluster(data, field, flagger, stat_func, thresh_func, b
detected
=
pd
.
Series
(
True
,
index
=
det_index
)
if
reduce_window
is
not
False
:
l
=
detected
.
shape
[
0
]
roller
=
customRoller
(
detected
,
window
=
reduce_window
,
min_periods
=
1
,
closed
=
'
both
'
,
center
=
True
)
roller
=
customRoller
(
detected
,
window
=
reduce_window
)
start
,
end
=
roller
.
window
.
get_window_bounds
(
num_values
=
l
,
min_periods
=
1
,
closed
=
'
both
'
,
center
=
True
)
detected
=
_reduceCPCluster
(
stat_arr
[
result_arr
],
thresh_arr
[
result_arr
],
start
,
end
,
reduce_func
,
l
)
...
...
This diff is collapsed.
Click to expand it.
saqc/lib/rolling.py
+
3
−
3
View file @
bac2aaec
...
...
@@ -324,9 +324,9 @@ def customRoller(obj, window, min_periods=None, # aka minimum non-nan values
Notes
-----
If for some reason the start and end numeric indices of the window are needed, one can call
`start, end = customRoller(obj,
...
).window.get_window_bounds(
)`, which return two arrays
,
holding the start and end indices. Any passed (allowed) parameter to `get_window_bounds()` is
ignored and the arguments that was passed to `customRoller()` beforehand will be used instead
.
`start, end = customRoller(obj,
window
).window.get_window_bounds(
num_values, min_periods)`
,
which return two np.arrays, that are holding the start and end indices. Fill at least all
parameter which are shown in the example
.
See Also
--------
...
...
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