diff --git a/simrunner/simrunner.py b/simrunner/simrunner.py index 709702a362e72f3bcb4a4e344d0a524d5c62408c..4e58abea1d7bb829c296aab41ee956e4e73313d0 100644 --- a/simrunner/simrunner.py +++ b/simrunner/simrunner.py @@ -34,7 +34,7 @@ def set_arguments(data_config): def run_sim(e_list, d_path, s_path): for event in e_list: folder_name = event[-1] - relativ_path = os.path.join(d_path, "output1", folder_name) + relativ_path = os.path.join(d_path, folder_name) os.makedirs(relativ_path, mode=0o777, exist_ok=True) event[-1] = relativ_path arguments = event @@ -42,18 +42,16 @@ def run_sim(e_list, d_path, s_path): print(output) -def give_controller(d_path): - json_path = os.path.join(main_folder, 'visualizer', 'data_folder_path.json') - with open(json_path, "w") as file: - json.dump(d_path, file) - - +# --- MAIN --- +# Setup all paths an folders main_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) data_path = os.path.join(main_folder, "output1") protokoll_path = os.path.join(main_folder, "protokoll") os.makedirs(protokoll_path, mode=0o777, exist_ok=True) sim_path = os.path.join(os.path.dirname(__file__), "../build/src/detsim") -give_controller(data_path) +# Setup arguments for Sim event_list = set_arguments(read_config()) + +# Run detectorSimulation run_sim(event_list, data_path, sim_path) diff --git a/visualizer/visualizer/main.py b/visualizer/visualizer/main.py index 54d3f15ecaf2dc672841c6009ace9bb7b2f65e3c..22dc9c567982914ad69dbbb1ff623d7777e396ca 100644 --- a/visualizer/visualizer/main.py +++ b/visualizer/visualizer/main.py @@ -1,8 +1,5 @@ -import os -import json +import argparse import matplotlib -import pandas as pd -import seaborn as sns from .DataFrameCreator import DataFrameCreator from .SeabornPlotter import SeabornPlotter matplotlib.use('TkAgg') @@ -10,15 +7,21 @@ matplotlib.use('TkAgg') # --------------Main------------ def main(): - json_path = "data_folder_path.json" - with open(json_path, "r") as file: - data_folder = json.load(file) - creator = DataFrameCreator(data_folder) + # Parse Arguments + parser = argparse.ArgumentParser() + parser.add_argument("-d", "--data_path", required=True, help="path to Data from Sim") + args = parser.parse_args() + data_path = args.data_path + + # Import Data + creator = DataFrameCreator(data_path) dataframes = creator.create_dataframes() + + # Setup Plotter plotter = SeabornPlotter(dataframes['write']) - # Plot erstellen + # Plotter run plotter.plot()