src.pydasa.analysis.scenario#

This module provides the Sensitivity class for performing sensitivity analysis on dimensional coefficients derived from dimensional analysis in PyDASA.

IMPORTANT
  • Based on the theory from H. Görtler, Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen

Classes#

Sensitivity

Performs sensitivity analysis on dimensional coefficients in PyDASA to determine which variables have the most significant impact on the system behavior.

Module Contents#

class src.pydasa.analysis.scenario.Sensitivity#

Bases: pydasa.core.basic.Foundation

Performs sensitivity analysis on dimensional coefficients in PyDASA to determine which variables have the most significant impact on the system behavior.

Inherits from:
  • Foundation: basic class for validation of symbols and frameworks and allow to use the attributes name, description, idx, sym, alias, fwk, and cat.

name#

User-friendly name of the sensitivity analysis.

Type:

str

Return type:

str

description#

Brief summary of the sensitivity analysis.

Type:

str

idx#

Index/precedence of the sensitivity analysis.

Type:

int

Return type:

int

sym#

Symbol representation (LaTeX or alphanumeric).

Type:

str

Return type:

str

alias#

Python-compatible alias for use in code.

Type:

str

Return type:

Optional[str]

fwk#

Frameworks context (PHYSICAL, COMPUTATION, SOFTWARE, CUSTOM).

Type:

str

Return type:

str

__post_init__()#

Post Initialization behaviour for sensitivity analysis. Validates basic properties, sets default values, and processes the expression if provided.

Return type:

None

set_coefficient(coef)#

Configure the sensitivity analysis from a coefficient.

Parameters:

coef (Coefficient) – Dimensionless coefficient to analyze.

Raises:

ValueError – If the coefficient doesn’t have a valid expression.

Return type:

None

analyze_symbolically(vals)#

Perform the symbolic sensitivity analysis for the coefficient.

Parameters:

vals (Dict[str, float]) – Dictionary mapping variable names to values.

Returns:

Sensitivity results for each variable.

Return type:

Dict[str, float]

analyze_numerically(vals, bounds, iters=-1)#

Perform the numerical sensitivity analysis for the coefficient.

Parameters:
  • vals (List[str]) – List of variable names to analyze.

  • bounds (List[List[float]]) – Bounds for each variable [min, max].

  • iters (int, optional) – Number of iterations to use. Defaults to -1.

Returns:

Detailed sensitivity analysis results.

Return type:

Dict[str, Any]

property cat: str#

Get the analysis category.

Returns:

Category (SYM, NUM).

Return type:

str

property pi_expr: str | None#

Get the coefficient expression to analyze.

Returns:

LaTeX expression.

Return type:

Optional[str]

property sym_func: sympy.Expr | None#

Get the symbolic expression.

Returns:

SymPy symbolic expression.

Return type:

Optional[sp.Expr]

property exe_func: Callable | Dict[str, Callable] | None#

Get the executable function.

Returns:

Executable function for numerical evaluation.

Return type:

Optional[Union[Callable, Dict[str, Callable]]]

property variables: Dict[str, pydasa.elements.parameter.Variable]#

Get the coefficient’s variable dictionary.

Returns:

Variables dictionary.

Return type:

Dict[str, Variable]

property schema: pydasa.dimensional.vaschy.Schema#

Get the dimensional schema.

Returns:

Current dimensional schema.

Return type:

Schema

property symbols: Dict[sympy.Symbol, sympy.Symbol]#

Get the Python symbols for the variables.

Returns:

Dictionary mapping variable names to sympy symbols.

Return type:

Dict[sp.Symbol, sp.Symbol]

property aliases: Dict[str, sympy.Symbol]#

Get the Python aliases for the variables.

Returns:

Python-compatible variable names.

Return type:

Dict[str, sp.Symbol]

property var_names: List[str]#

Get the list of variable names extracted from the expression.

Returns:

Ordered list of variable names.

Return type:

List[str]

property coefficient: pydasa.dimensional.buckingham.Coefficient | None#

Get the dimensionless coefficient specification.

Returns:

Coefficient specification.

Return type:

Optional[Coefficient]

property latex_to_py: Dict[str, str]#

Get the mapping from LaTeX symbols to Python compatible names.

Returns:

LaTeX to Python symbol mapping.

Return type:

Dict[str, str]

property py_to_latex: Dict[str, str]#

Get the mapping from Python compatible names to LaTeX symbols.

Returns:

Python to LaTeX symbol mapping.

Return type:

Dict[str, str]

property var_bounds: List[List[float]]#

Get the min/max bounds for each variable.

Returns:

Bounds for each variable.

Return type:

List[List[float]]

property var_values: Dict[str, float]#

Get the values for symbolic analysis.

Returns:

Variable values for symbolic analysis.

Return type:

Dict[str, float]

property var_domains: numpy.ndarray | None#

Get the sample domain for numerical analysis.

Returns:

Sample domain (inputs) or None if not computed.

Return type:

Optional[np.ndarray]

property var_ranges: numpy.ndarray | None#

Get the sample value range for numerical analysis.

Returns:

Sample value range (results) or None if not computed.

Return type:

Optional[np.ndarray]

property results: Dict[str, Any]#

Get the analysis results.

Returns:

Analysis results dictionary.

Return type:

Dict[str, Any]

property experiments: int#

Get the number of experiments for analysis. :returns: Number of experiments. :rtype: int

Return type:

int

clear()#

Reset all attributes to default values.

Resets all sensitivity analysis properties to their initial state.

Return type:

None

to_dict()#

Convert the sensitivity analysis into a valid Python dictionary representation.

Returns:

Dictionary representation of sensitivity analysis.

Return type:

Dict[str, Any]

classmethod from_dict(data)#

Creates a sensitivity analysis instance from dictionary representation.

Parameters:

data (Dict[str, Any]) – Dictionary representation of sensitivity analysis.

Returns:

New sensitivity analysis instance.

Return type:

Sensitivity