src.pydasa.workflows.basic ========================== .. py:module:: src.pydasa.workflows.basic .. autoapi-nested-parse:: Module base.py =========================================== Base class for common attributes and methods shared across all workflow **PyDASA** workflow management. Classes: **WorkflowBase**: Base class for all workflow orchestrators with common analysis components and validation methods. Attributes ---------- .. autoapisummary:: src.pydasa.workflows.basic.Variables src.pydasa.workflows.basic.Coefficients src.pydasa.workflows.basic.FDUs Classes ------- .. autoapisummary:: src.pydasa.workflows.basic.WorkflowBase Module Contents --------------- .. py:data:: Variables accepts Variable instances or dicts. :type: Type hint for variables input .. py:data:: Coefficients accepts Coefficient instances or dicts. :type: Type hint for coefficients input .. py:data:: FDUs accepts framework strings, Schema objects, or FDU definitions. :type: Type hint for schema input .. py:class:: WorkflowBase **WorkflowBase** Base class for PyDASA workflow orchestrators. Provides common attributes and validation methods shared across: - **AnalysisEngine**: Dimensional analysis workflow (phenomena.py) - **SensitivityAnalysis**: Sensitivity analysis workflow (influence.py) - **MonteCarloSimulation**: Monte Carlo experiments workflow (practical.py) .. attribute:: _variables All variables in the model. :type: Dict[str, Variable] .. attribute:: _schema Dimensional framework schema. :type: Optional[Schema] .. attribute:: _coefficients All coefficients in the model. :type: Dict[str, Coefficient] .. attribute:: _results Consolidated results from workflow. :type: Dict[str, Dict[str, Any]] .. attribute:: _is_solved Flag indicating if the workflow has been solved. :type: bool .. py:attribute:: _variables :type: Dict[str, pydasa.elements.parameter.Variable] All variables in the workflow. .. py:attribute:: _schema :type: Optional[pydasa.dimensional.vaschy.Schema] :value: None Dimensional framework schema for the workflow. After __post_init__, this will always be a Schema instance. .. py:attribute:: _coefficients :type: Dict[str, pydasa.dimensional.buckingham.Coefficient] Generated coefficients in the workflow. .. py:attribute:: _results :type: Dict[str, Dict[str, Any]] Consolidated results from workflow. .. py:attribute:: _is_solved :type: bool :value: False Flag indicating if the workflow has been solved. .. py:method:: _convert_to_objects(data, tgt_cls) *_convert_to_objects()* Converts dictionary values to target class instances (Variable or Coefficient). Accepts either existing instances or dicts to convert. :param data: Input dictionary with values to convert. :type data: Dict[str, Any] :param tgt_cls: Target class to convert values to (Variable or Coefficient). :type tgt_cls: type :raises ValueError: If any value is neither the target class nor a dict. :returns: Dictionary with values converted to target class instances. :rtype: Dict[str, Any] .. py:method:: _convert_to_schema(val) *_convert_to_schema()* Converts various schema input formats to a Schema instance. Accepts: - str: Framework name (e.g., "PHYSICAL"), load known schema - Schema: Direct Schema instance - Dict: Complete Schema dict or single FDU definition - List[Dict]: Multiple FDU definitions for CUSTOM framework :param val: Schema in various formats. :type val: FDUs :raises TypeError: If val is not a valid type. :raises TypeError: If list items are not dicts. :returns: Converted Schema instance. :rtype: Schema .. py:property:: variables :type: Dict[str, pydasa.elements.parameter.Variable] *variables* Get the variable dictionary. :returns: Copy of variables dictionary. :rtype: Dict[str, Variable] .. py:property:: schema :type: Optional[pydasa.dimensional.vaschy.Schema] *schema* Get the dimensional framework schema. :returns: Schema instance or None. :rtype: Optional[Schema] .. py:property:: coefficients :type: Dict[str, pydasa.dimensional.buckingham.Coefficient] *coefficients* Get the coefficient dictionary. :returns: Copy of coefficients dictionary. :rtype: Dict[str, Coefficient] .. py:property:: results :type: Dict[str, Dict[str, Any]] *results* Get the result dictionary in the workflow. :returns: Copy of results dictionary. :rtype: Dict[str, Dict[str, Any]] .. py:property:: is_solved :type: bool *is_solved* Check if the workflow is finished. :returns: True if solved, False otherwise. :rtype: bool .. py:method:: reset() *reset* Reset the workflow state while preserving input configuration. Clears coefficients, results, and solved state. .. py:method:: clear() *clear()* Clear all workflow attributes, including variables, coefficients, results, and solved state. .. py:method:: to_dict() *to_dict()* Convert the workflow instance to a dictionary representation, handling nested Schema, Variable, and Coefficient objects. :returns: Dictionary representation of the workflow. :rtype: Dict[str, Any] .. py:method:: from_dict(data) :classmethod: *from_dict()* Create workflow instance from dictionary representation, converting dicts back to Variable, Coefficient, and Schema objects as needed. :param data: Dictionary representation of the workflow. :type data: Dict[str, Any] :returns: Workflow instance created from the dictionary. :rtype: WorkflowBase