pystra.sensitivity.SensitivityAnalysis#

class SensitivityAnalysis(limit_state, stochastic_model, analysis_options=None)[source]#

Bases: object

Sensitivity analysis for the FORM reliability index.

Computes \(\partial\beta / \partial\theta\) for each distribution parameter \(\theta\) declared by Distribution.sensitivity_params (by default, mean and standard deviation; subclasses may add shape parameters, etc.).

Two algorithms are available, selected by the numerical argument of run():

  • numerical=True — forward finite differences (default).

  • numerical=False — closed-form post-processing of a single FORM run using the approach of Bourinet (2017) [Bourinet2017]. This also returns sensitivities to correlation coefficients.

Parameters:
  • limit_state (LimitState) – The limit state function definition.

  • stochastic_model (StochasticModel) – The stochastic model (distributions + correlation).

  • analysis_options (AnalysisOptions, optional) – Options forwarded to each FORM run. Defaults are used if None.

Methods

run

Run FORM-based sensitivity analysis.

run_form

Alias for run() (backwards compatibility).

summary

Return a pandas DataFrame summarising sensitivity results.

run(numerical=True, delta=0.01)[source]#

Run FORM-based sensitivity analysis.

Parameters:
  • numerical (bool, optional) – If True (default), use forward finite differences: each parameter is perturbed by delta * stdv and FORM is re-run. If False, use the closed-form approach of Bourinet (2017) which post-processes a single FORM run.

  • delta (float, optional) – Relative perturbation size for the finite-difference method (default 0.01, i.e. 1 %). Ignored when numerical=False.

Returns:

When numerical=True:

{variable_name: {param: dβ/dθ, ...}}. The parameter keys come from each distribution’s sensitivity_params (typically "mean" and "std", but may include "shape" etc.).

When numerical=False:

{"marginal": {...}, "correlation": ndarray}.

The "correlation" entry is a symmetric n × n array where element (i, j) is \(\partial\beta / \partial\rho_{ij}\). Diagonal entries are zero.

Return type:

dict

run_form(numerical=True, delta=0.01)[source]#

Alias for run() (backwards compatibility).

summary(result)[source]#

Return a pandas DataFrame summarising sensitivity results.

Converts the nested dict returned by run() into a tidy DataFrame for convenient display in notebooks.

Parameters:

result (dict) – The result dict from run() (either FD or CF format).

Returns:

Columns: Variable, Parameter, ∂β/∂θ.

Return type:

pandas.DataFrame