Skip to content
Snippets Groups Projects
Commit 462dfd52 authored by gospodnetic's avatar gospodnetic
Browse files

Raise error if model has no asigned logs, give a possibiltiy to provide dir as...

Raise error if model has no asigned logs, give a possibiltiy to provide dir as input instead of of json list
parent 28a6a795
No related branches found
No related tags found
No related merge requests found
...@@ -128,6 +128,9 @@ class Benchmark: ...@@ -128,6 +128,9 @@ class Benchmark:
for model in self.log_container_per_model: for model in self.log_container_per_model:
tex_file.write("\n\\begin{longtable}{|c c c c c c c c|}\n") tex_file.write("\n\\begin{longtable}{|c c c c c c c c|}\n")
tex_file.write("\\hline\n") tex_file.write("\\hline\n")
if self.log_container_per_model[model].size() == 0:
raise Exception("Model log container of size 0, Object space exploration approach method likely not specified!")
first_log = self.log_container_per_model[model].logs[0] first_log = self.log_container_per_model[model].logs[0]
tex_file.write("\\multicolumn{{8}}{{|c|}}{{{} ({})}}\\\\\n".format(model, first_log.model["face_count"])) tex_file.write("\\multicolumn{{8}}{{|c|}}{{{} ({})}}\\\\\n".format(model, first_log.model["face_count"]))
tex_file.write("Method & Parameter & \\#VPC & \\#Discarded & \\#OVP & RT[S] & NBV[s] & coverage \\\\\n") tex_file.write("Method & Parameter & \\#VPC & \\#Discarded & \\#OVP & RT[S] & NBV[s] & coverage \\\\\n")
......
{ {
"SphereSampling": [ "SphereSampling": [
"AvgBbox", "AvgBbox",
"ConvexHull",
"FocusRepositioned",
"MaxBbox", "MaxBbox",
"MinBbox", "MinBbox",
"ConvexHull",
"ConvexHullNormal",
"FocusRepositioned",
"FocusRepositionedNormal",
"MixedRepositioned", "MixedRepositioned",
"MixedRepositionedNormal",
"NoDisplacement"], "NoDisplacement"],
"VertexBased": [ "VertexBased": [
"VertexBBoxCenter", "VertexBboxCenter",
"VertexNormal"], "VertexNormal"],
"GeometryBased": [ "GeometryBased": [
"Area", "Area",
......
...@@ -16,13 +16,19 @@ def extract_json_filenames(json_list): ...@@ -16,13 +16,19 @@ def extract_json_filenames(json_list):
ovp_filenames = [] ovp_filenames = []
for path in json_list: for path in json_list:
if os.path.isdir(path): if os.path.isdir(path):
for (dirpath, dirnames, filenames) in os.walk(path): ovp_filenames.extend(extract_files_from_dir(path))
ovp_filenames.extend(list(map(lambda x: dirpath + "/" + x, filenames)))
break
else: else:
ovp_filenames.append(path) ovp_filenames.append(path)
return filter_json(ovp_filenames) return filter_json(ovp_filenames)
def extract_files_from_dir(dir_path):
filenames = []
if os.path.isdir(dir_path):
for (dirpath, dirnames, filenames) in os.walk(dir_path):
filenames.extend(list(map(lambda x: dirpath + "/" + x, filenames)))
break
return filenames
def main(): def main():
if len(sys.argv) > 2: if len(sys.argv) > 2:
methods_per_approach_filename = sys.argv[1] methods_per_approach_filename = sys.argv[1]
...@@ -34,13 +40,16 @@ def main(): ...@@ -34,13 +40,16 @@ def main():
print("arg1 - methods_per_approach.json\narg2 - path_list\n[arg3] - graphs filename prefix") print("arg1 - methods_per_approach.json\narg2 - path_list\n[arg3] - graphs filename prefix")
exit() exit()
with open(path_list) as ovp_path_file: if (os.path.isdir(path_list)):
ovp_paths = json.load(ovp_path_file) filenames = filter_json(extract_files_from_dir(path_list))
else:
with open(path_list) as ovp_path_file:
ovp_paths = json.load(ovp_path_file)
filenames = extract_json_filenames(ovp_paths)
with open(methods_per_approach_filename) as methods_per_approach_file: with open(methods_per_approach_filename) as methods_per_approach_file:
methods_per_approach = json.load(methods_per_approach_file) methods_per_approach = json.load(methods_per_approach_file)
filenames = extract_json_filenames(ovp_paths)
# Load log files and sort them per model. # Load log files and sort them per model.
log_container_per_model = {} log_container_per_model = {}
logs = [] logs = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment