tolerancing.sensitivity_analysis

Sensitivity Analysis Module

This module contains the SensitivityAnalysis class for performing sensitivity analysis on a tolerancing system. The SensitivityAnalysis class allows users to run a sensitivity analysis on a Tolerancing object and visualize the results.

Kramer Harrison, 2024

Classes

SensitivityAnalysis(tolerancing)

Class for performing sensitivity analysis on a tolerancing system.

class SensitivityAnalysis(tolerancing: Tolerancing)[source]

Class for performing sensitivity analysis on a tolerancing system.

Parameters:

tolerancing (Tolerancing) – The tolerancing system to perform sensitivity analysis on.

tolerancing

The tolerancing system to perform sensitivity analysis on.

Type:

Tolerancing

operand_names

List of operand names in the tolerancing system.

Type:

list

_results

DataFrame to store the sensitivity analysis results.

Type:

pd.DataFrame

run()[source]

Runs the sensitivity analysis.

get_results()[source]

Returns the sensitivity analysis results.

view(figsize=(2.2, 3), sharex='col', sharey='row')[source]

Visualizes the sensitivity analysis results.

get_results()[source]

Returns the results of the sensitivity analysis.

Returns:

The results of the sensitivity analysis.

Return type:

pd.DataFrame

run()[source]

Run the sensitivity analysis.

This method performs a sensitivity analysis by iterating over the perturbations defined in the tolerancing object. For each perturbation, it applies the perturbation, applies compensators, evaluates operands, and saves the results. The results are stored in a pandas DataFrame in the _results attribute.

Raises:

ValueError – If a perturbation sampler other than RangeSampler is used.

view(figsize: tuple[float, float] = (2.5, 3.3), sharex: Literal['none', 'all', 'row', 'col'] | bool = 'col', sharey: Literal['none', 'all', 'row', 'col'] | bool = 'row') tuple[Figure, list[Axes]][source]

Visualizes the sensitivity analysis results.

Parameters:
  • figsize (tuple, optional) – The size of the figure in inches for each subplot. Default is (2.2, 3).

  • sharex (str, optional) – Specifies how the x-axis is shared among subplots. Default is ‘col’.

  • sharey (str, optional) – Specifies how the y-axis is shared among subplots. Default is ‘row’.

Returns:

A tuple containing the figure and axes of the plot.

Return type:

tuple