src.pydasa.dimensional.vaschy#

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#

Schema

Schema Manages dimensional frameworks and FDUs for PyDASA.

Module Contents#

class src.pydasa.dimensional.vaschy.Schema#

Bases: 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.

Parameters:

Foundation – Foundation class for validation of symbols and frameworks.

_fdu_lt#

List of Fundamental Dimensional Units in precedence order.

Type:

List[Dimension]

_fdu_map#

Dictionary mapping FDU symbols to Dimension objects.

Type:

Dict[str, Dimension]

_fdu_regex#

Regex pattern for matching dimensional expressions (e.g., ‘M/L*T^-2’ to ‘M^1*L^-1*T^-2’).

Type:

str

_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

_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

_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

__post_init__()#

__post_init__() Initializes the framework and sets up regex patterns.

Return type:

None

property fdu_lt: List[pydasa.dimensional.fundamental.Dimension]#

fdu_lt Get the list of FDUs in precedence order.

Returns:

List of FDUs.

Return type:

List[Dimension]

property fdu_symbols: List[str]#

fdu_symbols Get the list of FDU symbols in precedence order.

Returns:

List of FDU symbols.

Return type:

List[str]

property size: int#

size Get the number of FDUs in the framework.

Returns:

Number of FDUs.

Return type:

int

property fdu_regex: str#

fdu_regex Get the FDU regex pattern.

Returns:

Regex pattern for validating dimensional expressions.

Return type:

str

property fdu_pow_regex: str#

fdu_pow_regex Get the FDU powered regex pattern.

Returns:

Regex pattern for matching dimensions with exponents.

Return type:

str

property fdu_no_pow_regex: str#

fdu_no_pow_regex Get the FDU no-power regex pattern.

Returns:

Regex pattern for matching dimensions without exponents.

Return type:

str

property fdu_sym_regex: str#

fdu_sym_regex Get the FDU symbol regex pattern.

Returns:

Regex pattern for matching FDUs in symbolic expressions.

Return type:

str

get_fdu(symbol)#

get_fdu() Get an FDU by its symbol.

Parameters:

symbol (str) – FDU symbol.

Returns:

FDU object if found, None otherwise.

Return type:

Optional[Dimension]

has_fdu(symbol)#

has_fdu() Check if an FDU with the given symbol exists.

Parameters:

symbol (str) – FDU symbol.

Returns:

True if the FDU exists, False otherwise.

Return type:

bool

add_fdu(fdu)#

add_fdu() Add an FDU to the framework.

Parameters:

fdu (Dimension) – FDU to add.

Raises:
  • ValueError – If an FDU with the same symbol already exists.

  • ValueError – If the FDU framework does not match the current framework.

Return type:

None

remove_fdu(sym)#

remove_fdu() Remove an FDU from the framework.

Parameters:

sym (str) – Symbol of the FDU to remove.

Returns:

removed FDU object.

Return type:

Dimension

reset()#
Return type:

None

to_dict()#

to_dict() Convert framework to dictionary representation.

Returns:

Dictionary representation of the framework.

Return type:

Dict[str, Any]

classmethod from_dict(data)#

from_dict() Create framework from dictionary representation.

Parameters:

data (Dict[str, Any]) – Dictionary representation of the framework.

Returns:

New DimScheme instance.

Return type:

DimScheme