src.pydasa.dimensional.vaschy ============================= .. py:module:: src.pydasa.dimensional.vaschy .. autoapi-nested-parse:: Module framework.py =========================================== Module for **Schema** to manage Fundamental Dimensional Units (FDUs) for Dimensional Analysis in *PyDASA*. This module provides the Schema class which manages dimensional frameworks, FDU precedence, and regex patterns for dimensional expression validation. Classes: **Schema**: Manages dimensional frameworks and FDUs, providing methods for validation, *IMPORTANT:* Based on the theory from: # H.Gorter, *Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen* Classes ------- .. autoapisummary:: src.pydasa.dimensional.vaschy.Schema Module Contents --------------- .. py:class:: Schema Bases: :py:obj:`pydasa.core.basic.Foundation` **Schema** Manages dimensional frameworks and FDUs for *PyDASA*. Maintains a collection of Dimensions with their precedence, provides regex patterns for dimensional expressions, and manages the dimensional framework context. :param Foundation: Foundation class for validation of symbols and frameworks. .. attribute:: _fdu_lt List of Fundamental Dimensional Units in precedence order. :type: List[Dimension] .. attribute:: _fdu_map Dictionary mapping FDU symbols to Dimension objects. :type: Dict[str, Dimension] .. attribute:: _fdu_regex Regex pattern for matching dimensional expressions (e.g., 'M/L*T^-2' to 'M^1*L^-1*T^-2'). :type: str .. attribute:: _fdu_pow_regex Regex pattern for matching dimensions with exponents. (e.g., 'M*L^-1*T^-2' to 'M^(1)*L^(-1)*T^(-2)'). :type: str .. attribute:: _fdu_no_pow_regex Regex pattern for matching dimensions without exponents. (e.g., 'M*L*T' to 'M^(1)*L^(1)*T^(1)'). :type: str .. attribute:: _fdu_sym_regex Regex pattern for matching FDUs in symbolic expressions. (e.g., 'M^(1)*L^(-1)*T^(-2)' to 'L**(-1)*M**(1)*T**(-2)'). :type: str .. py:method:: __post_init__() *__post_init__()* Initializes the framework and sets up regex patterns. .. py:property:: fdu_lt :type: List[pydasa.dimensional.fundamental.Dimension] *fdu_lt* Get the list of FDUs in precedence order. :returns: List of FDUs. :rtype: List[Dimension] .. py:property:: fdu_symbols :type: List[str] *fdu_symbols* Get the list of FDU symbols in precedence order. :returns: List of FDU symbols. :rtype: List[str] .. py:property:: size :type: int *size* Get the number of FDUs in the framework. :returns: Number of FDUs. :rtype: int .. py:property:: fdu_regex :type: str *fdu_regex* Get the FDU regex pattern. :returns: Regex pattern for validating dimensional expressions. :rtype: str .. py:property:: fdu_pow_regex :type: str *fdu_pow_regex* Get the FDU powered regex pattern. :returns: Regex pattern for matching dimensions with exponents. :rtype: str .. py:property:: fdu_no_pow_regex :type: str *fdu_no_pow_regex* Get the FDU no-power regex pattern. :returns: Regex pattern for matching dimensions without exponents. :rtype: str .. py:property:: fdu_sym_regex :type: str *fdu_sym_regex* Get the FDU symbol regex pattern. :returns: Regex pattern for matching FDUs in symbolic expressions. :rtype: str .. py:method:: get_fdu(symbol) *get_fdu()* Get an FDU by its symbol. :param symbol: FDU symbol. :type symbol: str :returns: FDU object if found, None otherwise. :rtype: Optional[Dimension] .. py:method:: has_fdu(symbol) *has_fdu()* Check if an FDU with the given symbol exists. :param symbol: FDU symbol. :type symbol: str :returns: True if the FDU exists, False otherwise. :rtype: bool .. py:method:: add_fdu(fdu) *add_fdu()* Add an FDU to the framework. :param fdu: FDU to add. :type fdu: Dimension :raises ValueError: If an FDU with the same symbol already exists. :raises ValueError: If the FDU framework does not match the current framework. .. py:method:: remove_fdu(sym) *remove_fdu()* Remove an FDU from the framework. :param sym: Symbol of the FDU to remove. :type sym: str :returns: removed FDU object. :rtype: Dimension .. py:method:: reset() .. py:method:: to_dict() *to_dict()* Convert framework to dictionary representation. :returns: Dictionary representation of the framework. :rtype: Dict[str, Any] .. py:method:: from_dict(data) :classmethod: *from_dict()* Create framework from dictionary representation. :param data: Dictionary representation of the framework. :type data: Dict[str, Any] :returns: New DimScheme instance. :rtype: DimScheme