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
f45d322f
Commit
f45d322f
authored
Jun 02, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize histogram graph generation
parent
1383ec9e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
measure-analysis/measure-analysis.py
measure-analysis/measure-analysis.py
+11
-16
No files found.
measure-analysis/measure-analysis.py
View file @
f45d322f
...
@@ -170,7 +170,10 @@ class MeasureSetHandler:
...
@@ -170,7 +170,10 @@ class MeasureSetHandler:
common_metadatas
=
[]
common_metadatas
=
[]
for
metadata_name
in
first_metadata
:
for
metadata_name
in
first_metadata
:
if
metadata_name
not
in
metadata_mask
:
if
metadata_name
not
in
metadata_mask
:
if
metadata_name
in
MeasureSet
.
abbreviations
:
common_metadatas
.
append
(
"{}: {}"
.
format
(
MeasureSet
.
abbreviations
[
metadata_name
],
first_metadata
[
metadata_name
]))
common_metadatas
.
append
(
"{}: {}"
.
format
(
MeasureSet
.
abbreviations
[
metadata_name
],
first_metadata
[
metadata_name
]))
else
:
common_metadatas
.
append
(
"{}: {}"
.
format
(
metadata_name
,
first_metadata
[
metadata_name
]))
report
.
write
(
", "
.
join
(
common_metadatas
)
+
"
\
n
\
n
"
)
report
.
write
(
", "
.
join
(
common_metadatas
)
+
"
\
n
\
n
"
)
for
mid
in
self
.
measure_sets
[
mtype
][
'ids'
]:
for
mid
in
self
.
measure_sets
[
mtype
][
'ids'
]:
...
@@ -270,13 +273,6 @@ class MeasureSet:
...
@@ -270,13 +273,6 @@ class MeasureSet:
self
.
avg
=
[
statistics
.
mean
(
prop
)
for
prop
in
props
]
self
.
avg
=
[
statistics
.
mean
(
prop
)
for
prop
in
props
]
self
.
var
=
[
statistics
.
variance
(
prop
)
for
prop
in
props
]
self
.
var
=
[
statistics
.
variance
(
prop
)
for
prop
in
props
]
def
histogram_to_chronological
(
histogram
):
chrono
=
list
(
map
(
lambda
x
:
[
x
[
0
]]
*
x
[
1
],
list
(
enumerate
(
histogram
))))
chrono
=
[
x
for
l
in
chrono
for
x
in
l
]
return
chrono
def
add_histogram
(
self
,
props_names
,
props
):
def
add_histogram
(
self
,
props_names
,
props
):
self
.
props
=
props
self
.
props
=
props
...
@@ -375,16 +371,15 @@ class MeasureSet:
...
@@ -375,16 +371,15 @@ class MeasureSet:
self
.
add_chronological
(
props_names
,
props
)
self
.
add_chronological
(
props_names
,
props
)
def
generate_histogram
(
self
,
i
,
color
):
def
generate_histogram
(
self
,
i
,
color
):
histogram
=
MeasureSet
.
histogram_to_chronological
(
self
.
props
[
i
])
n
,
bins
,
patches
=
plt
.
hist
(
histogram
,
len
(
self
.
props
[
i
]),
facecolor
=
color
,
alpha
=
0.5
)
max_height
=
max
([
patch
.
get_height
()
for
patch
in
patches
])
bins
=
[
i
for
i
in
range
(
self
.
max
[
i
]
+
1
)]
min_height
=
max_height
/
100.0
vals
=
self
.
props
[
i
][:
self
.
max
[
i
]
+
1
]
min_val
=
max
(
vals
)
/
140
vals
=
list
(
map
(
lambda
x
:
min_val
if
x
!=
0
and
x
<
min_val
else
x
,
vals
))
for
j
,
patch
in
enumerate
(
patches
):
plt
.
bar
(
bins
,
vals
)
height
=
patch
.
get_height
()
if
self
.
props
[
i
][
j
]
>
0
and
height
<
min_height
:
patch
.
set_height
(
min_height
)
def
generate_chrono_graph
(
self
,
i
,
color
):
def
generate_chrono_graph
(
self
,
i
,
color
):
prop
=
self
.
props
[
i
]
prop
=
self
.
props
[
i
]
...
...
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