Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
nexedi
tsn-measures
Commits
94c6cd7e
Commit
94c6cd7e
authored
Jun 04, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Offset the histogram data if needed
parent
ff0ffd42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
measure-analysis/measure-analysis.py
measure-analysis/measure-analysis.py
+12
-7
No files found.
measure-analysis/measure-analysis.py
View file @
94c6cd7e
...
...
@@ -316,10 +316,11 @@ class MeasureSet:
return
metadata
def
add_metadata
(
self
,
measure_type
,
units
,
metadata
):
def
add_metadata
(
self
,
measure_type
,
units
,
m
iddle
,
m
etadata
):
self
.
measure_type
=
measure_type
self
.
units
=
units
self
.
middle
=
middle
self
.
metadata
.
update
(
metadata
)
def
add_chronological
(
self
,
props_names
,
props
):
...
...
@@ -348,12 +349,12 @@ class MeasureSet:
enumerate_prop
=
list
(
enumerate
(
prop
))
self
.
max
.
append
(
max
(
list
(
map
(
lambda
x
:
x
[
0
]
if
x
[
1
]
else
0
,
enumerate_prop
))))
self
.
min
.
append
(
min
(
map
(
lambda
x
:
x
[
0
]
if
x
[
1
]
else
0
,
enumerate_prop
)))
self
.
max
.
append
(
max
(
list
(
map
(
lambda
x
:
(
x
[
0
]
-
self
.
middle
)
if
x
[
1
]
else
0
,
enumerate_prop
))))
self
.
min
.
append
(
min
(
map
(
lambda
x
:
(
x
[
0
]
-
self
.
middle
)
if
x
[
1
]
else
0
,
enumerate_prop
)))
sum_prop
=
sum
(
prop
)
avg
=
sum
(
map
(
lambda
x
:
x
[
0
]
*
x
[
1
],
enumerate_prop
))
/
sum_prop
avg
=
sum
(
map
(
lambda
x
:
abs
(
x
[
0
]
-
self
.
middle
)
*
x
[
1
],
enumerate_prop
))
/
sum_prop
var
=
0
for
x
,
p
in
enumerate_prop
:
var
+=
p
*
x
**
2
...
...
@@ -407,8 +408,12 @@ class MeasureSet:
measure_type
=
data
[
'measure_type'
]
units
=
data
[
'units'
]
metadata
=
data
[
'metadata'
]
if
'middle'
in
data
:
middle
=
data
[
'middle'
]
else
:
middle
=
0
self
.
add_metadata
(
measure_type
,
units
,
metadata
)
self
.
add_metadata
(
measure_type
,
units
,
m
iddle
,
m
etadata
)
props_names
=
data
[
'props_names'
]
...
...
@@ -434,8 +439,8 @@ class MeasureSet:
def
generate_histogram
(
self
,
i
,
color
,
name
):
bins
=
[
i
for
i
in
range
(
self
.
max
[
i
]
+
1
)]
vals
=
self
.
props
[
i
][
:
self
.
max
[
i
]
+
1
]
bins
=
[
i
for
i
in
range
(
self
.
m
in
[
i
],
self
.
m
ax
[
i
]
+
1
)]
vals
=
self
.
props
[
i
][
self
.
min
[
i
]
+
self
.
middle
:
self
.
max
[
i
]
+
self
.
middle
+
1
]
min_val
=
max
(
vals
)
/
140
...
...
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