Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre Donat-Bouillud
audio-adaptive-scheduling
Commits
767e1182
Commit
767e1182
authored
Mar 19, 2019
by
Pierre Donat-Bouillud
Browse files
Export to tikz for graphs
parent
c035e468
Pipeline
#814
passed with stage
in 2 minutes and 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pipeline.py
View file @
767e1182
...
...
@@ -26,6 +26,7 @@ from operator import itemgetter
from
scipy
import
stats
import
bisect
from
matplotlib2tikz
import
save
as
tikz_save
parser
=
argparse
.
ArgumentParser
(
description
=
"Generate graphs, execute them, and then evaluate their quality"
,
\
epilog
=
"Please indicate in a pipeline.json file where the process thqt executes graphs is located."
)
...
...
@@ -38,6 +39,7 @@ parser.add_argument("--only-draw", help="Only draws graph", action="store_true")
parser
.
add_argument
(
"-r"
,
"--random"
,
help
=
"Randomly generates the graphs"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--no-error"
,
help
=
"Continue in spite of errors"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--dir"
,
help
=
"Directory where to process"
)
parser
.
add_argument
(
"--tikz"
,
help
=
"Save graphs in tikz format"
,
action
=
"store_true"
)
args
=
parser
.
parse_args
()
...
...
@@ -361,7 +363,7 @@ def fisher_mean(r):
"""Use Fisher's transform to compute an overall correlation"""
return
np
.
tanh
(
np
.
mean
(
np
.
arctanh
(
r
)))
def
plot
(
qualities_mes
,
costs_mes
,
qualities_th
,
costs_th
):
def
plot
(
name
,
qualities_mes
,
costs_mes
,
qualities_th
,
costs_th
):
fig
,
axes
=
plt
.
subplots
(
2
,
1
)
ax1
=
axes
[
0
]
...
...
@@ -412,6 +414,8 @@ def plot(qualities_mes, costs_mes, qualities_th, costs_th):
fig
.
tight_layout
()
fig
.
legend
()
if
args
.
tikz
:
tikz_save
(
name
+
".tex"
)
plt
.
show
()
#print("limits are: x1=[", ax1.get_xlim(), "], x2=[", ax2.get_xlim(), "]")
...
...
@@ -434,7 +438,7 @@ if args.graph:
q_mes
,
c_mes
=
load_csv
(
basename
+
"-exec-report.csv"
)
q_th
,
c_th
=
load_csv
(
basename
+
"-theo.csv"
)
# Display in a graph
plot
(
q_mes
,
c_mes
,
q_th
,
c_th
)
plot
(
basename
,
q_mes
,
c_mes
,
q_th
,
c_th
)
os
.
chdir
(
".."
)
elif
args
.
nodes
:
dirname
=
os
.
getcwd
()
...
...
@@ -445,6 +449,7 @@ elif args.nodes:
except
:
pass
os
.
chdir
(
dirname
)
basename
,
_
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
dirname
))
kendalltau_costs_rhos
=
[]
kendalltau_qualities_rhos
=
[]
spearmanr_costs_rhos
=
[]
...
...
@@ -460,7 +465,7 @@ elif args.nodes:
kendalltau_qualities_rhos
.
append
(
kendaltau
.
quality
[
0
])
spearmanr_costs_rhos
.
append
(
spearmanr
.
costs
[
0
])
spearmanr_qualities_rhos
.
append
(
spearmanr
.
quality
[
0
])
result_all_graphs_to_csv
(
dir
name
+
"-correlations.csv"
,
results
)
result_all_graphs_to_csv
(
base
name
+
"-correlations.csv"
,
results
)
else
:
kendalltau_costs_rhos
,
kendalltau_qualities_rhos
,
spearmanr_costs_rhos
,
spearmanr_qualities_rhos
=
load_correlations
(
dirname
+
"-correlations.csv"
)
...
...
@@ -497,6 +502,9 @@ elif args.nodes:
fig
.
legend
()
if
args
.
tikz
:
tikz_save
(
basename
+
".tex"
,
figure
=
fig
)
plt
.
show
()
# Try also to do a Fisher transformation to get a better idea
...
...
Write
Preview
Supports
Markdown
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