How to Get Data into the System#
This guide explains the different ways to read data into the system. Important to know is that the first time you read in a Simulation, the raw files are read and after that a pickle file is created. So the next time instead of the raw files we will read in the pickle, which is much faster.
After rerunning your simulation(s) it is important to re-read the raw files. This is done as follows:
api.global_settings.reader.force_reread_prt = True
Do not forget to turn this off again for faster data loading.
Common Arguments#
The following arguments are commonly used across different data loading functions:
results_folder: Apathlib.Pathobject containing the path to all simulations you want to process.processing_scenarios: A single processing step or an array of steps.comparison_scenario: A single comparison_step or an array of steps.
Reading in a Single Simulation#
sim_folder: Apathlib.Pathobject containing the path to your simulation results.
simulation = api.process_single_simulation(sim_folder, processing_scenarios)
Reading in Multiple Simulations#
simulations_data = api.process_whole_result_set(results_folder, processing_scenarios)
Reading in Multiple Simulations in Parallel#
max_workers: An optional argument that defines how many processors the function should use. If nothing is provided it will use as many as it can.
simulations_data = api.process_whole_result_set_parallel(results_folder, processing_scenarios, max_workers=4)
For Comparison#
api.do_comparison(comparison_scenario, results_folder)
After calling pytrnsys_process.api.process_whole_result_set() or
pytrnsys_process.api.process_whole_result_set_parallel().
You can use the returned pytrnsys_process.api.SimulationsData object
and pass it to the pytrnsys_process.api.do_comparison() function.
api.do_comparison(comparison_scenario, simulations_data)