Skip to content

sensitivity.analysis

Sensitivity analysis.

SensitivityOutput dataclass

SensitivityOutput(uid, name, unit)

Output measurement for SensitivityAnalysis.

AnalysisGroup dataclass

AnalysisGroup(uid, name, changes, color)

Subgroup for analysis.

SensitivitySimulation

SensitivitySimulation(
    model_path, selections, changes_simulation, outputs
)

Base class for sensitivity calculation.

The sensitivity simulation runs a model simulation under a given set of model changes and returns a dictionary of scalar outputs. This function is called repeatedly during the sensitivity calculation.

Initialize the simulation with model, selections, changes and outputs.

load_model staticmethod

load_model(model_path, selections)

Load roadrunner model.

apply_changes staticmethod

apply_changes(r, changes, reset_all=True)

Apply changes after possible reset of the model.

simulate

simulate(r, changes)

Run a model simulation and return scalar results dictionary.

parameter_values classmethod

parameter_values(r, parameters, changes)

Get the parameter values for a given set of changes.

plot

plot()

Plot the model simulation.

SensitivityAnalysis

SensitivityAnalysis(
    sensitivity_simulation,
    parameters,
    groups,
    results_path,
    seed=None,
    n_cores=None,
    cache_results=False,
)

Parent class for all sensitivity analysis.

Create a sensitivity analysis for given parameter ids.

Based on the results matrix the sensitivity is calculated.

output_ids property

output_ids

Ids of the outputs.

parameter_ids property

parameter_ids

Ids of the parameters.

group_ids property

group_ids

Ids of the analysis groups.

num_parameters property

num_parameters

Number of parameters.

num_outputs property

num_outputs

Number of outputs.

num_groups property

num_groups

Number of analysis groups.

num_samples property

num_samples

Number of samples.

Requires that samples have been created. Assumes all groups have the same number of samples.

execute

execute()

Execute the sensitivity analysis.

create_samples

create_samples()

Create and set parameter samples.

simulate_samples

simulate_samples(cache_filename=None, cache=False)

Simulate all samples in parallel.

:param cache_filename: Path to the cache path. :param cache: If True, cache the simulated samples.

calculate_sensitivity

calculate_sensitivity(cache_filename=None, cache=False)

Calculate the sensitivity matrices.

samples_required

samples_required(group_id)

Samples of a group, raises if the samples are not created yet.

results_required

results_required(group_id)

Results of a group, raises if the samples are not simulated yet.

samples_table

samples_table()

Sizes of the sample arrays per group.

results_table

results_table()

Sizes of the result arrays per group.

read_cache

read_cache(cache_filename, cache)

Read cached data from the results path, None if not cached.

write_cache

write_cache(data, cache_filename, cache)

Write data to the cache file in the results path.

sensitivity_df

sensitivity_df(group_id, key)

Convert sensitivity information to dataframes.

plot

plot()

Plot the results, implemented by the subclasses.

run_simulation

run_simulation(params_tuple)

Pass all required arguments as parameter tuple.