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#
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.FoundationPerforms 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.
- _exe_func: Callable | Dict[str, Callable] | None = None#
Executable function(s) for numerical evaluation (compiled from symbolic form).
- _variables: Dict[str, pydasa.elements.parameter.Variable]#
Variable symbols in the expression.
- _schema: pydasa.dimensional.vaschy.Schema#
Dimensional framework schema for FDU management.
- _coefficient: pydasa.dimensional.buckingham.Coefficient | None = None#
Specifications of the dimensionless coefficient to analyse.
- _symbols: Dict[sympy.Symbol, sympy.Symbol]#
Python symbols for the variables.
- _var_domains: numpy.ndarray | None = None#
Sample domain (inputs) for numerical analysis.
- _var_ranges: numpy.ndarray | None = None#
Sample value range (results) for numerical analysis.
- _validate_sym_expr(val)#
Confirm that the input symbolic expression is a SymPy expression.
- Parameters:
val (Any) – Possible expression/value to validate.
- Raises:
ValueError – If value is not a valid SymPy expression.
- Return type:
None
- _validate_exec_func(val)#
Confirm executable function is type Callable or dict of Callable.
- Parameters:
val (Any) – Possible executable function/value to validate.
- Raises:
ValueError – If value is not a callable or dict of callables.
- Return type:
None
- _validate_analysis_ready()#
Confirm if the sensitivity analysis is ready to be performed.
- Raises:
ValueError – If the variables are missing.
ValueError – If the python-compatible variables are missing.
ValueError – If the symbolic expression is missing.
- 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
- _parse_expression(expr)#
Parse the LaTeX expression into a valid SymPy function.
- Parameters:
expr (str) – LaTeX expression to parse.
- Raises:
ValueError – If the expression cannot be parsed.
TypeError – If parsed result is not a valid SymPy expression.
- Return type:
None
- analyze_symbolically(vals)#
Perform the symbolic sensitivity analysis for the coefficient.
- analyze_numerically(vals, bounds, iters=-1)#
Perform the numerical sensitivity analysis for the coefficient.
- 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.
- property schema: pydasa.dimensional.vaschy.Schema#
Get the dimensional schema.
- Returns:
Current dimensional schema.
- Return type:
- 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.
- property py_to_latex: Dict[str, str]#
Get the mapping from Python compatible names to LaTeX symbols.
- 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_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:
- 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]