experimentsimulator.py¶
This module is used for performing Monte-Carlo virtual experiments over a series of input simulation cases and sensor arrays.
- class ExperimentStats(mean=None, std=None, max=None, min=None, med=None, q25=None, q75=None, mad=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.
- mean¶
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).
- std¶
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)
- max¶
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)
- min¶
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)
- med¶
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)
- q25¶
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¶
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)
- mad¶
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)
- __init__(mean=None, std=None, max=None, min=None, med=None, q25=None, q75=None, mad=None)¶
- class ExperimentSimulator(sim_list, sensor_arrays, num_exp_per_sim)[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.
- __init__(sim_list, sensor_arrays, num_exp_per_sim)[source]¶
- 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.
- get_sim_list()[source]¶
Gets the list of simulations to run simulated experiments for.
- Returns:
list[mh.SimData]
– List of simulation data objects.
- get_sensor_arrays()[source]¶
Gets the sensor array list for this experiment.
- Returns:
list[ISensorArray]
– List of sensor arrays for the simulated experiment.
- run_experiments()[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).
- calc_stats()[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.