Controler Module
src/controller/controller.py PLASMAG 2024 Software, LPP
- class src.controler.controller.CalculationController(params_dict=None, backups_count=3)
Bases:
objectThe CalculationController class is responsible for managing the calculation engine and the input parameters of the engine. This controller is the main interface between the user interface and the calculation engine. It can be used to run the engine headless or to update the parameters and run the calculations.
- clear_calculation_results()
Clears the current results from the calculation engine.
- delete_spice_nodes(spice_nodes: list)
- export_CLTF_NEMI(path)
IF the node is NEMI, and the node CLTF_filtered, plot both in the same graph and save it in the path :param path: Full path to save the graph :return: SUCCESS or ERROR
- get_current_results()
Retrieves the most recent results from the calculation engine output class if the data is marked as ready.
Returns: - dict or None: The current results if available; otherwise, None if no calculations have been run or data is not ready.
- get_old_results()
Retrieves the previous set of results from the calculation engine.
Returns: - dict: The results of the previous calculations performed by the engine.
- run_calculation()
Executes the calculations based on the current set of parameters and strategies defined in the engine. Marks the data as ready and returns the current results.
Returns: - dict: The results of the calculations performed by the engine.
- save_current_results(index)
Saves the current results to the output data of the calculation engine.
Parameters: - index (int): The index of the current results to be saved.
- set_node_strategy(node_name, strategy_class, params_dict)
- swap_strategy_map(strategy_map)
- update_parameters(params_dict)
Updates the input parameters of the calculation engine using the provided dictionary. This method also triggers the update of the engine’s parameters and marks the output data as ready for plot.
- Parameters:
params_dict (dict): A dictionary containing the new parameters to be updated in the engine.
The dict should respect the following format:
{ "param1": value1, "param2": value2, ... }
- Returns:
dict: The current results after updating the parameters, if any calculation was previously run.