src.pydasa.workflows.influence#

Module for SensitivityAnalysis to manage sensitivity analysis in PyDASA

This module provides the SensitivityAnalysis class for coordinating multiple sensitivity analyses and generating reports on which variables have the most significant impact on dimensionless coefficients.

Classes:

SensitivityAnalysis: Manages sensitivity analyses for multiple coefficients, processes results, and generates reports on variable impacts.

IMPORTANT: Based on the theory from:

# H.Gorter, Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen

Classes#

SensitivityAnalysis

SensitivityAnalysis class for managing multiple sensitivity analyses in PyDASA.

Module Contents#

class src.pydasa.workflows.influence.SensitivityAnalysis#

Bases: pydasa.core.basic.Foundation, pydasa.workflows.basic.WorkflowBase

SensitivityAnalysis class for managing multiple sensitivity analyses in PyDASA.

Coordinates sensitivity analyses for multiple coefficients, processes their results, and generates comprehensive reports on variable impacts.

Parameters:
  • Foundation (Foundation) – Inherits common validation logic.

  • WorkflowBase (WorkflowBase) – Inherits workflow basic functionalities.

# From Foundation

name (str): User-friendly name of the sensitivity analysis. description (str): Brief summary of the sensitivity analysis. _idx (int): Index/precedence of the sensitivity analysis. _sym (str): Symbol representation (LaTeX or alphanumeric). _alias (str): Python-compatible alias for use in code. _fwk (str): Frameworks context (PHYSICAL, COMPUTATION, SOFTWARE, CUSTOM).

Type:

Identification and Classification

# From WorkflowBase

_variables (Dict[str, Variable]): All available parameters/variables in the model (Variable). Accepts Variable instances or dicts. _schema (Optional[Schema]): Dimensional framework schema for the workflow. After __post_init__, this will always be a Schema instance. _coefficients (Dict[str, Coefficient]): All available coefficients in the model (Coefficient). Accepts Coefficient instances or dicts. _results (Dict[str, Dict[str, Any]]): Consolidated results from sensitivity analyses. _is_solved (bool): Flag indicating if the sensitivity analysis workflow has been completed.

Type:

Common Workflow Components

# Specific to SensitivityAnalysis

_cat (str): Category of sensitivity analysis (SYM, NUM, HYB). _analyses (Dict[str, Sensitivity]): All sensitivity analyses performed for each coefficient.

_cat: str = 'SYM'#

Category of sensitivity analysis workflow (SYM, NUM).

_analyses: Dict[str, pydasa.analysis.scenario.Sensitivity]#

Dictionary of sensitivity analyses performed in the workflow.

_create_analyses()#

_create_analyses() Creates sensitivity analyses for each coefficient.

Sets up Sensitivity objects for each coefficient to be analyzed.

Return type:

None

_get_variable_value(var_sym, val_type='mean')#

_get_variable_value() Gets a value for a variable based on value type.

Parameters:
  • var_sym (str) – Symbol of the variable.

  • val_type (str, optional) – Type of value to return (mean, min, max). Defaults to “mean”.

Returns:

Variable value.

Return type:

float

Raises:
analyze_symbolic(val_type='mean')#

analyze_symbolic() Performs symbolic sensitivity analysis.

Analyzes each coefficient using symbolic differentiation at specified values.

Parameters:

val_type (str, optional) – Type of value to use (mean, min, max). Defaults to “mean”.

Returns:

Sensitivity results by coefficient and variable.

Return type:

Dict[str, Dict[str, float]]

analyze_numeric(n_samples=1000)#

analyze_numeric() Performs numerical sensitivity analysis.

Analyzes each coefficient using Fourier Amplitude Sensitivity Test (FAST).

Parameters:

n_samples (int, optional) – Number of samples to use. Defaults to 1000.

Returns:

Sensitivity results by coefficient.

Return type:

Dict[str, Dict[str, Any]]

property cat: str#

cat Get the analysis category.

Returns:

Category (SYM, NUM, HYB).

Return type:

str

property analyses: Dict[str, pydasa.analysis.scenario.Sensitivity]#

analyses Get the dictionary of sensitivity analyses.

Returns:

Dictionary of sensitivity analyses.

Return type:

Dict[str, Sensitivity]

reset()#

reset() Reset the analysis state while preserving input configuration.

Clears coefficients, results, analyses, and solved state while keeping variables and schema.

Return type:

None

clear()#

clear() Reset all attributes to default values.

Resets all analysis properties to their initial state, including variables, coefficients, and results from WorkflowBase.

Return type:

None

to_dict()#

to_dict() Convert sensitivity analysis to dictionary representation.

Returns:

Dictionary representation of sensitivity analysis.

Return type:

Dict[str, Any]

classmethod from_dict(data)#

from_dict() Create sensitivity analysis from dictionary representation.

Parameters:

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

Returns:

New sensitivity analysis instance.

Return type:

SensitivityAnalysis