Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
osie
Commits
346c845e
Commit
346c845e
authored
May 16, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better and more readable import.
parent
07782aa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
rt_analyzer/analyze.py
rt_analyzer/analyze.py
+30
-24
No files found.
rt_analyzer/analyze.py
View file @
346c845e
...
...
@@ -21,6 +21,7 @@ timestamp_channel0_delta_list = []
timestamp_channel1_delta_list
=
[]
lines_list
=
f
.
readlines
()
f
.
close
()
for
line
in
lines_list
[
1
:]:
timestamp
,
channel0
,
channel1
=
line
.
split
(
","
)
timestamp
=
float
(
timestamp
)
...
...
@@ -63,10 +64,19 @@ for line in lines_list[1:]:
last_channel1_value
=
channel1
# find average, mean, standard deviation, etc on these lists of deltas
# as all data comes in seconds convert to milli seconds by multiplying by denominator
round_base
=
5
denominator
=
1000
# convert lists from seconds -> milli seconds
timestamp_channel0_delta_list
=
[
x
*
denominator
for
x
in
timestamp_channel0_delta_list
]
timestamp_channel1_delta_list
=
[
x
*
denominator
for
x
in
timestamp_channel1_delta_list
]
# calculate it
channel0_mean
=
statistics
.
mean
(
timestamp_channel0_delta_list
)
channel0_median
=
statistics
.
median
(
timestamp_channel0_delta_list
)
channel0_median
=
statistics
.
median
(
timestamp_channel0_delta_list
)
channel0_stdev
=
statistics
.
stdev
(
timestamp_channel0_delta_list
)
channel0_stdev_percentile
=
(
channel0_stdev
*
100
)
/
channel0_median
channel0_stdev_percentile
=
(
channel0_stdev
*
100
)
/
channel0_median
try
:
channel0_mode
=
statistics
.
mode
(
timestamp_channel0_delta_list
)
except
statistics
.
StatisticsError
:
...
...
@@ -77,7 +87,7 @@ channel0_max = max(timestamp_channel0_delta_list)
channel1_mean
=
statistics
.
mean
(
timestamp_channel1_delta_list
)
channel1_median
=
statistics
.
median
(
timestamp_channel1_delta_list
)
channel1_stdev
=
statistics
.
stdev
(
timestamp_channel1_delta_list
)
channel1_stdev_percentile
=
(
channel1_stdev
*
100
)
/
channel1_median
channel1_stdev_percentile
=
(
channel1_stdev
*
100
)
/
channel1_median
try
:
channel1_mode
=
statistics
.
mode
(
timestamp_channel1_delta_list
)
except
statistics
.
StatisticsError
:
...
...
@@ -89,26 +99,22 @@ stop_time = lines_list[-1].split(",")[0]
print
(
"Timestamp records = "
,
len
(
lines_list
))
print
(
"Duration (seconds) = "
,
stop_time
)
print
(
"Channel0 (in seconds):"
)
print
(
"
\
t
Mean = "
,
channel0_mean
)
print
(
"
\
t
Median = "
,
channel0_median
)
print
(
"
\
t
Min = "
,
channel0_min
)
print
(
"
\
t
Max = "
,
channel0_max
)
print
(
"
\
t
Standart deviation = "
,
channel0_stdev
)
print
(
"
\
t
Standart deviation (%) = "
,
channel0_stdev_percentile
)
print
(
"
\
t
Mode (most occurencies) = "
,
channel0_mode
)
print
(
"
\
n
Channel1 (in seconds):"
)
print
(
"
\
t
Mean = "
,
channel1_mean
)
print
(
"
\
t
Median = "
,
channel1_median
)
print
(
"
\
t
Min = "
,
channel1_min
)
print
(
"
\
t
Max = "
,
channel1_max
)
print
(
"
\
t
Standart deviation = "
,
channel1_stdev
)
print
(
"
\
t
Standart deviation (%) = "
,
channel1_stdev_percentile
)
print
(
"
\
t
Mode (most occurencies) = "
,
channel1_mode
)
print
(
"Channel0 (in
milli
seconds):"
)
print
(
"
\
t
Mean = "
,
round
(
channel0_mean
,
round_base
)
)
print
(
"
\
t
Median = "
,
round
(
channel0_median
,
round_base
)
)
print
(
"
\
t
Min = "
,
round
(
channel0_min
,
round_base
)
)
print
(
"
\
t
Max = "
,
round
(
channel0_max
,
round_base
)
)
print
(
"
\
t
Standart deviation = "
,
round
(
channel0_stdev
,
round_base
)
)
print
(
"
\
t
Standart deviation (%) = "
,
round
(
channel0_stdev_percentile
,
round_base
)
)
print
(
"
\
t
Mode (most occurencies) = "
,
round
(
channel0_mode
,
round_base
)
)
print
(
"
\
n
Channel1 (in
milli
seconds):"
)
print
(
"
\
t
Mean = "
,
round
(
channel1_mean
,
round_base
)
)
print
(
"
\
t
Median = "
,
round
(
channel1_median
,
round_base
)
)
print
(
"
\
t
Min = "
,
round
(
channel1_min
,
round_base
)
)
print
(
"
\
t
Max = "
,
round
(
channel1_max
,
round_base
)
)
print
(
"
\
t
Standart deviation = "
,
round
(
channel1_stdev
,
round_base
)
)
print
(
"
\
t
Standart deviation (%) = "
,
round
(
channel1_stdev_percentile
,
round_base
)
)
print
(
"
\
t
Mode (most occurencies) = "
,
round
(
channel1_mode
,
round_base
)
)
f
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment