experimental.new_evaluator.simulation_output.factory module
Wrap-up creation and execution of ISimulationOutputEvaluator
.
Todo
Maybe should inherit from a more generic factory.
- class SimulationOutputEvaluatorsFactory(evaluator_kwargs: ~collections.abc.Collection[dict[str, str | float | bool]], user_evaluators: dict[str, type] | None = None, plotter: ~experimental.plotter.i_plotter.IPlotter = <experimental.plotter.pd_plotter.PandasPlotter object>)
Bases:
object
Define a class to create and execute multiple evaluators.
- __init__(evaluator_kwargs: ~collections.abc.Collection[dict[str, str | float | bool]], user_evaluators: dict[str, type] | None = None, plotter: ~experimental.plotter.i_plotter.IPlotter = <experimental.plotter.pd_plotter.PandasPlotter object>) None
Instantiate object with basic attributes.
- Parameters:
evaluator_kwargs (Collection[EvaluatorKwargs]) – Dictionaries holding necessary information to instantiate the evaluators. The only mandatory key-value pair is “name” of type str.
user_evaluators (dict[str, type] | None, optional) – Additional user-defined evaluators; keys should be in PascalCase, values
ISimulationOutputEvaluator
constructors.plotter (IPlotter, optional) – An object used to produce plots. The default is
PandasPlotter
.
- _instantiate_evaluators(reference: SimulationOutput) list[ISimulationOutputEvaluator]
Create all the evaluators.
- Parameters:
reference (SimulationOutput) – The reference simulation output.
- Returns:
All the created evaluators.
- Return type:
- batch_evaluate(evaluators: Collection[ISimulationOutputEvaluator], accelerators: Sequence[Accelerator], beam_solver_id: str, plot_kwargs: dict[str, Any] | None = None, csv_kwargs: dict[str, Any] | None = None, **kwargs) DataFrame
Evaluate several evaluators.
- run(accelerators: Sequence[Accelerator], beam_solver_id: str) list[ISimulationOutputEvaluator]
Instantiate all the evaluators.
- _constructors_n_kwargs(evaluator_kwargs: Collection[dict[str, str | float | bool]], user_evaluators: dict[str, type] | None = None) dict[type, dict[str, bool | float | str]]
Take and associate every evaluator class with its kwargs.
We also remove the “name” key from the kwargs.
- Parameters:
evaluator_kwargs (Collection[dict[str, str | float | bool]]) – Dictionaries holding necessary information to instantiate the evaluators. The only mandatory key-value pair is “name” of type str.
user_evaluators (dict[str, type] | None, optional) – Additional user-defined evaluators; keys should be in PascalCase, values
ISimulationOutputEvaluator
constructors.
- Returns:
Keys are class constructor, values associated keyword arguments.
- Return type:
dict[type, dict[str | float | bool]]
- _out_folders(simulation_outputs: Collection[SimulationOutput]) list[Path]
Get the output folders.