experimentsimulator

This module is used for performing Monte-Carlo virtual experiments over a series of input simulation cases and sensor arrays.

class pyvale.experimentsimulator.ExperimentSimulator(sim_list: list[SimData], sensor_arrays: list[ISensorArray], num_exp_per_sim: int)[source]

Bases: object

An experiment simulator for running monte-carlo analysis by applying a list of sensor arrays to a list of simulations over a given number of user defined experiments. Calculates summary statistics for each sensor array applied to each simulation.

Parameters:
  • sim_list (list[mh.SimData]) -- List of simulation data objects over which the virtual experiments will be performed.

  • sensor_arrays (list[ISensorArray]) -- The sensor arrays that will be applied to each simulation to generate the virtual experiment data.

  • num_exp_per_sim (int) -- Number of virtual experiments to perform for each simulation and sensor array.

calc_stats() list[ExperimentStats][source]

Calculates summary statistics over the number of virtual experiments specified. If run_experiments() has not been called then it is called to generate the virtual experimental data to perform the statistical calculations.

Returns:

list[ExperimentStats] -- List of summary statistics data classes for the virtual experiments. The list index correponds to the virtual sensor array.

run_experiments() list[ndarray][source]

Runs the specified number of virtual experiments over the number of input simulation cases and virtual sensor arrays.

Returns:

list[np.ndarray] -- List of virtual experimental data arrays where the list index corresponds to the virtual sensor array and the data is an array with shape=(n_sims,n_exps,n_sens,n_comps,n_time_steps).

class pyvale.experimentsimulator.ExperimentStats(mean: ndarray | None = None, std: ndarray | None = None, max: ndarray | None = None, min: ndarray | None = None, med: ndarray | None = None, q25: ndarray | None = None, q75: ndarray | None = None, mad: ndarray | None = None)[source]

Bases: object

Dataclass holding summary statistics for a series of simulated experiments produced using the experiment simulator. All summary statistics are calculated over the 'experiments' dimension of the measurements array so the arrays of statistics have the shape=(n_sims,n_sensors,n_field_comps, n_time_steps). Note that the n_sims dimension refers to the number of input multi-physics simulations (i.e. SimData objects) that the virtual experiments were performed over.

mad: ndarray | None

Median absolute deviation of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors, n_field_comps, n_time_steps)

max: ndarray | None

Maximum of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors,n_field_comps,n_time_steps)

mean: ndarray | None

Mean of each sensors measurement for the given field component and time step as an array with shape=(n_sims,n_sensors,n_field_comps,n_time_steps).

med: ndarray | None

Median of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors,n_field_comps,n_time_steps)

min: ndarray | None

Minmum of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors,n_field_comps,n_time_steps)

q25: ndarray | None

Lower 25% quantile of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors, n_field_comps, n_time_steps)

q75: ndarray | None

Upper 75% quantile of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors, _field_comps, n_time_steps)

std: ndarray | None

Standard deviation of the sensor measurements for the given field component and time step as an array with shape=(n_sims,n_sensors, n_field_comps, n_time_steps)