/ src / plotter / run_plotter.py
run_plotter.py
 1  # Python Imports
 2  import seaborn as sns
 3  import matplotlib.pyplot as plt
 4  
 5  # Project Imports
 6  from src.utilities.env_variables import SHARED_FOLDER
 7  from src.utilities.files.simulation_data_parser import SimulationDataParser
 8  
 9  
10  def run_plotter(arguments_config: dict, plotter_config: dict):
11      file_name = f"{arguments_config['output-file']}.{arguments_config['output-format']}"
12      # Read file given in arguments config
13      parser = SimulationDataParser()
14      polars_df = parser.read_content(SHARED_FOLDER + file_name)
15  
16      pandas_df = polars_df.to_pandas()
17  
18      # Loop through all plots given in plotting section
19      for plot, options in plotter_config.items():
20          print(plot)
21          print(options)
22          method = getattr(sns, plot)
23          method(pandas_df, **options["plot_options"])
24          plt.savefig(SHARED_FOLDER + options["save_options"]["name"])