Commit aefd826b authored by Pierre Donat-Bouillud's avatar Pierre Donat-Bouillud

Correctly retrieve costs and name the graphs in the csv

parent 0a358731
Pipeline #986 passed with stage
in 2 minutes and 31 seconds
......@@ -95,10 +95,6 @@ def get_costs(csvname):
nb_rows += 1
return total / float(nb_rows), total
def execute_graph(graph):
tqdm.write("Executing graph " + graph)
subprocess.run([graph_exec, "-m", "-b", "-c", "10000", graph], check=True)
def get_exec_times(graph):
# Get execution times for reports (-m option)
basename,_ = os.path.splitext(os.path.basename(graph))
......@@ -108,6 +104,11 @@ def get_exec_times(graph):
tqdm.write("Retrieving monitoring info from "+ csvfile)
return get_costs(csvfile)
def execute_graph(graph):
tqdm.write("Executing graph " + graph)
subprocess.run([graph_exec, "-m", "-b", "-c", "10000", graph], check=True)
return get_exec_times(graph)
def compare_audio_files(audiofiles):
audiofiles.sort()# Number 0 is always the non-degraded file
non_degraded = audiofiles.pop(0)
......@@ -289,6 +290,8 @@ def process_all_graphs(nb_nodes, dirname, random=False, from_graphs=False):
print(nb_errors, " graphs were discarded due to execution errors")
return results
def graph_number(name):
return int(name.rsplit("-", maxsplit=1)[1])
def results_to_csv(graphname, qualities, costs):
fieldnames=["Name", "Quality", "Cost", "Total"]
......@@ -298,7 +301,7 @@ def results_to_csv(graphname, qualities, costs):
writer.writeheader()
#Get cost original graph
name = list(sorted(costs.keys()))[0]
result["Name"] = name
result["Name"] = graph_number(name)
cost, total = costs[name]
result["Quality"] = 1.0
result["Cost"] = cost
......@@ -306,6 +309,7 @@ def results_to_csv(graphname, qualities, costs):
writer.writerow(result)
for graph in qualities.keys():
result={}
result["Name"] = graph_number(graph)
result["Quality"] = qualities[graph]
cost, total = costs[graph]
result["Cost"] = cost
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment