matflow.subset_simulation.subset_simulation#

Module containing functions to run a subset simulation on a simple toy model, used as a validation of the MatFlow implementation.

Functions

cumsum_transformation_adjoint

Adjoint (transpose-Jacobian action) for transformation = lambda x: np.cumsum(x, axis=-1).

dist_to_str

Return a string representation of a distribution.

estimate_cov

Estimate the coefficient of variation at a given conditional level of the subset simulation.

generate_coarse_subchain

generate_next_level_samples

Generate one conditional Subset Simulation level using MMH.

generate_next_level_samples_ACS

Generate one conditional level using adaptive conditional sampling (aka adaptive subset infinity).

generate_next_level_samples_CS

Generate one conditional level using conditional sampling (aka subset infinity).

generate_next_level_samples_DA

Generate one conditional level using fixed-subchain RST.

generate_next_level_samples_DA_single_inner

Delayed-acceptance modified Metropolis algorithm for subset simulation.

generate_next_state

Proposal must be a symmetric distribution centred on zero.

generate_next_state_ACS

generate_next_state_CS

get_approx_pf_random_walk

get_approx_y_star_random_walk

get_stats

get_toy_model_results_from_matflow_workflows

param root_path:

A directory containing only (zipped) workflows that are toy-model subset

get_y_star

get_y_star_max_system

Analytic failure threshold for a 'weakest-link' (series-system) toy model: the system response is the maximum over dimension iid standard normal components, so P(max(X) <= y) = Phi(y)**dimension, giving an exact threshold for a target failure probability.

log_surrogate_weight

Note temperature should be of a similar order of magnitude to g_coarse and threshold.

make_voxel_grouping

Partition dimension fine grid points into contiguous blocks of block_size (the last block may be smaller), representing a coarser mesh voxelisation.

model

plot_cov_dist

plot_cov_estimates

plot_many_pf_num_samples

plot_many_pf_num_samples_from_files

plot_pf_dist

plot_pf_num_samples

run_convergence

Run a convergence test on the toy model subset simulation, for either number of samples per level, N, or number of repeats, R.

run_repeats

sample_direct_MC

subset_simulation

Estimate failure probability using Subset Simulation.

system_analysis_toy_model

x is within the failure domain if the return is greater than zero.

voxel_block_average

Coarse-grain x (..., dimension) by averaging within each block defined by group_idx, broadcasting each block's mean back over its fine positions (so fine and coarse fields live in the same space).

weakest_link_coarse_gradient_xt

Analytic gradient of weakest_link_performance_coarse (i.e.

weakest_link_performance_coarse

'Coarse mesh' weakest-link performance: as weakest_link_performance_fine, but evaluated on a block-averaged (coarser-voxelised) version of the field.

weakest_link_performance_fine

'Fine mesh' weakest-link performance: the system fails if the peak local response (max over all dimension fine grid points) exceeds y_star -- e.g.