Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calc-stats
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
util
sequencer
calc-stats
Commits
70dd8d3c
Commit
70dd8d3c
authored
3 years ago
by
Giulio Gaio
Browse files
Options
Downloads
Patches
Plain Diff
Clean lp correlation history from zeros
parent
aa4f229f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/CalcStats.py
+6
-2
6 additions, 2 deletions
src/CalcStats.py
with
6 additions
and
2 deletions
src/CalcStats.py
+
6
−
2
View file @
70dd8d3c
...
...
@@ -811,8 +811,12 @@ class DeviceObj:
# calculate the correlation, numpy indexes start from 1
self
.
corr
[
t_idx
]
=
np
.
corrcoef
(
sensor_array
,
target_array
)[
0
,
1
]
# low pass filter correlation
self
.
old_lp_filter_corr
[
t_idx
]
=
self
.
lp_filter_corr
[
t_idx
];
self
.
lp_filter_corr
[
t_idx
]
=
lp_filter
*
np
.
absolute
(
self
.
corr
[
t_idx
])
+
(
1
-
lp_filter
)
*
self
.
old_lp_filter_corr
[
t_idx
]
# if data is 0/inf/NaN keep the previous value in order to avoid corrupting the filtered value
if
(
self
.
corr
[
t_idx
]
==
0
)
or
np
.
isnan
(
self
.
corr
[
t_idx
])
or
np
.
isinf
(
self
.
corr
[
t_idx
])
self
.
lp_filter_corr
[
t_idx
]
=
self
.
old_lp_filter_corr
[
t_idx
]
else
self
.
old_lp_filter_corr
[
t_idx
]
=
self
.
lp_filter_corr
[
t_idx
];
self
.
lp_filter_corr
[
t_idx
]
=
lp_filter
*
np
.
absolute
(
self
.
corr
[
t_idx
])
+
(
1
-
lp_filter
)
*
self
.
old_lp_filter_corr
[
t_idx
]
# correlation calculated with the bottom half of sensor values
self
.
corr_low
[
t_idx
]
=
np
.
corrcoef
(
sensor_array_sort
[
1
:
int
(
self
.
valid_samples
/
2
)],
target_array_sort
[
1
:
int
(
self
.
valid_samples
/
2
)])[
0
,
1
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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