Skip to content

Commit

Permalink
Add cuda plots
Browse files Browse the repository at this point in the history
  • Loading branch information
niermann999 committed Jan 8, 2025
1 parent 7d513c9 commit 8f5a937
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 143 deletions.
12 changes: 5 additions & 7 deletions tests/tools/python/impl/plot_benchmark_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
""" Read google benchmark data from json file """


def read_benchmark_data(input_path, logging, det_name, plugin):
def read_benchmark_data(input_path, logging, benchmark_file):

# Input data directory
input_dir = os.fsencode(input_path)
Expand All @@ -43,21 +43,19 @@ def read_benchmark_data(input_path, logging, det_name, plugin):
for file_item in os.listdir(input_dir):
file_name = os.fsdecode(file_item)

if (file_name.find(det_name + "_benchmark_data_") != -1) and (
file_name.find(plugin) != -1
):
if file_name == os.path.basename(benchmark_file):
file_path = input_path + file_name
with open(file_path, "r") as file:
logging.debug(f"Reading file '{file_path}'")

results = json.load(file)

context = results["context"]
data = pd.DataFrame(results["benchmarks"])

return context, data

logging.error(
f"Could not find benchmark results for '{det_name}' and plugin '{plugin}'"
)
logging.error(f"Could not find file: {benchmark_file}")

return None, None

Expand Down
6 changes: 2 additions & 4 deletions tests/tools/python/material_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
parse_detector_io_options,
parse_plotting_options,
)
from utils import read_detector_name

# python includes
import argparse
Expand Down Expand Up @@ -144,10 +145,7 @@ def __main__():

logging.info("Generating data plots...\n")

geo_file = open(args.geometry_file)
json_geo = json.loads(geo_file.read())

det_name = json_geo["header"]["common"]["detector"]
det_name = read_detector_name(args.geometry_file, logging)
logging.debug("Detector: " + det_name)

df_scan, df_cpu, df_cuda = read_material_data(in_dir, logging, det_name, args.cuda)
Expand Down
6 changes: 2 additions & 4 deletions tests/tools/python/navigation_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
parse_plotting_options,
)
from plotting import pyplot_factory as plt_factory
from utils import read_detector_name

# python imports
import argparse
Expand Down Expand Up @@ -182,10 +183,7 @@ def __main__():

logging.info("Generating data plots...\n")

geo_file = open(args.geometry_file)
json_geo = json.loads(geo_file.read())

det_name = json_geo["header"]["common"]["detector"]
det_name = read_detector_name(args.geometry_file, logging)
logging.debug("Detector: " + det_name)

# Check the data path (should have been created when running the validation)
Expand Down
4 changes: 1 addition & 3 deletions tests/tools/python/plotting/pyplot_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def graph(
y_min=None,
y_max=None,
color=None,
alpha=0.75,
marker=".",
set_log_x=False,
set_log_y=False,
Expand Down Expand Up @@ -186,8 +185,7 @@ def add_graph(
y_errors=None,
label="",
marker="+",
color="tab:orange",
alpha=0.75,
color=None,
):
# Nothing left to do
if len(y) == 0 or plot.data is None:
Expand Down
Loading

0 comments on commit 8f5a937

Please sign in to comment.