pydasa 0.4.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. pydasa/__init__.py +103 -0
  2. pydasa/_version.py +6 -0
  3. pydasa/analysis/__init__.py +0 -0
  4. pydasa/analysis/scenario.py +584 -0
  5. pydasa/analysis/simulation.py +1158 -0
  6. pydasa/context/__init__.py +0 -0
  7. pydasa/context/conversion.py +11 -0
  8. pydasa/context/system.py +17 -0
  9. pydasa/context/units.py +15 -0
  10. pydasa/core/__init__.py +15 -0
  11. pydasa/core/basic.py +287 -0
  12. pydasa/core/cfg/default.json +136 -0
  13. pydasa/core/constants.py +27 -0
  14. pydasa/core/io.py +102 -0
  15. pydasa/core/setup.py +269 -0
  16. pydasa/dimensional/__init__.py +0 -0
  17. pydasa/dimensional/buckingham.py +728 -0
  18. pydasa/dimensional/fundamental.py +146 -0
  19. pydasa/dimensional/model.py +1077 -0
  20. pydasa/dimensional/vaschy.py +633 -0
  21. pydasa/elements/__init__.py +19 -0
  22. pydasa/elements/parameter.py +218 -0
  23. pydasa/elements/specs/__init__.py +22 -0
  24. pydasa/elements/specs/conceptual.py +161 -0
  25. pydasa/elements/specs/numerical.py +469 -0
  26. pydasa/elements/specs/statistical.py +229 -0
  27. pydasa/elements/specs/symbolic.py +394 -0
  28. pydasa/serialization/__init__.py +27 -0
  29. pydasa/serialization/parser.py +133 -0
  30. pydasa/structs/__init__.py +0 -0
  31. pydasa/structs/lists/__init__.py +0 -0
  32. pydasa/structs/lists/arlt.py +578 -0
  33. pydasa/structs/lists/dllt.py +18 -0
  34. pydasa/structs/lists/ndlt.py +262 -0
  35. pydasa/structs/lists/sllt.py +746 -0
  36. pydasa/structs/tables/__init__.py +0 -0
  37. pydasa/structs/tables/htme.py +182 -0
  38. pydasa/structs/tables/scht.py +774 -0
  39. pydasa/structs/tools/__init__.py +0 -0
  40. pydasa/structs/tools/hashing.py +53 -0
  41. pydasa/structs/tools/math.py +149 -0
  42. pydasa/structs/tools/memory.py +54 -0
  43. pydasa/structs/types/__init__.py +0 -0
  44. pydasa/structs/types/functions.py +131 -0
  45. pydasa/structs/types/generics.py +54 -0
  46. pydasa/validations/__init__.py +0 -0
  47. pydasa/validations/decorators.py +510 -0
  48. pydasa/validations/error.py +100 -0
  49. pydasa/validations/patterns.py +32 -0
  50. pydasa/workflows/__init__.py +1 -0
  51. pydasa/workflows/influence.py +497 -0
  52. pydasa/workflows/phenomena.py +529 -0
  53. pydasa/workflows/practical.py +765 -0
  54. pydasa-0.4.7.dist-info/METADATA +320 -0
  55. pydasa-0.4.7.dist-info/RECORD +58 -0
  56. pydasa-0.4.7.dist-info/WHEEL +5 -0
  57. pydasa-0.4.7.dist-info/licenses/LICENSE +674 -0
  58. pydasa-0.4.7.dist-info/top_level.txt +1 -0
@@ -0,0 +1,146 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Module fundamental.py
4
+ ===========================================
5
+
6
+ Module for representing the **FDU** or **Fundamental Dimensional Unit** for Dimensional Analysis in *PyDASA*.
7
+
8
+ Classes:
9
+ **Dimension**: Represents a Fundamental Dimensional Unit (FDU) with validation and conversion capabilities.
10
+
11
+ *IMPORTANT:* Based on the theory from:
12
+
13
+ # H.Gorter, *Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen*
14
+ """
15
+
16
+ # native python modules
17
+ # import dataclass for defining the node class
18
+ from __future__ import annotations
19
+ from dataclasses import dataclass
20
+ # import re
21
+
22
+ # custom modules
23
+ from pydasa.core.basic import Foundation
24
+
25
+ # generic error handling and type checking
26
+ from pydasa.validations.error import handle_error as error
27
+
28
+ # import validation decorators
29
+ from pydasa.validations.decorators import validate_type, validate_emptiness
30
+
31
+ # checking custom modules
32
+ assert error
33
+
34
+
35
+ @dataclass
36
+ class Dimension(Foundation):
37
+ """
38
+ **Dimension** class for processing the data of a Fundamental Dimensional Unit (FDU) in *PyDASA*.
39
+
40
+ FDUs are fundamental building blocks of dimensional analysis and are used to define the dimensions of physical and digital quantities.
41
+
42
+ Args:
43
+ Foundation: Foundation class for validation of symbols and frameworks.
44
+
45
+ Attributes:
46
+ _idx (int): The Index of the Fundamental Dimension (precedence in the Dimensional Matrix).
47
+ _sym (str): The symbol of the Fundamental Dimension (LaTeX or alphanumeric).
48
+ _alias (str): The Python-compatible alias for the Fundamental Dimension, used in executable code.
49
+ _fwk (str): The framework of the Fundamental Dimension (PHYSICAL, COMPUTATION, SOFTWARE, CUSTOM).
50
+ _unit (str): The basic unit of the Fundamental Dimension, useful for unit of meassure convertion (e.g.: km -> m or GB -> bit).
51
+ name (str): User-friendly name of the Fundamental Dimension.
52
+ description (str): Brief summary of the Fundamental Dimension.
53
+ """
54
+ # All attributes and validation logic are inherited from SymBasis.
55
+ # You can add any FDU-specific methods or overrides here if needed.
56
+
57
+ # :attr: _idx
58
+ _unit: str = ""
59
+ """Basic unit of the Fundamental Dimension (e.g.: m, s, bit)."""
60
+
61
+ def __post_init__(self) -> None:
62
+ """*__post_init__()* Post-initialization processing with symbol and framework validation.
63
+ """
64
+ # Call the parent class's post-init
65
+ super().__post_init__()
66
+
67
+ # Validate the unit
68
+ if not self.unit:
69
+ self._unit = self._unit.strip()
70
+
71
+ @property
72
+ def unit(self) -> str:
73
+ """*unit* Get the framework.
74
+
75
+ Returns:
76
+ str: Frameworks value
77
+ """
78
+ return self._unit
79
+
80
+ @unit.setter
81
+ @validate_type(str, allow_none=False)
82
+ @validate_emptiness()
83
+ def unit(self, val: str) -> None:
84
+ """*unit* Set the unit with validation.
85
+
86
+ Args:
87
+ val (str): Unit value
88
+
89
+ Raises:
90
+ ValueError: If unit is not supported
91
+ """
92
+ self._unit = val
93
+
94
+ def to_dict(self) -> dict:
95
+ """*to_dict* Convert the Dimension to a dictionary representation.
96
+
97
+ Returns:
98
+ dict: Dictionary representation of the Dimension.
99
+ """
100
+ return {
101
+ "idx": self._idx,
102
+ "sym": self._sym,
103
+ "alias": self._alias,
104
+ "fwk": self._fwk,
105
+ "unit": self._unit,
106
+ "name": self.name,
107
+ "description": self.description
108
+ }
109
+
110
+ @classmethod
111
+ def from_dict(cls, data: dict) -> Dimension:
112
+ """*from_dict* Create a Dimension instance from a dictionary.
113
+
114
+ Args:
115
+ data (dict): Dictionary containing Dimension attributes.
116
+
117
+ Returns:
118
+ Dimension: Instance of Dimension created from the dictionary.
119
+ """
120
+ return cls(
121
+ _idx=data.get("idx", -1),
122
+ _sym=data.get("sym", ""),
123
+ _alias=data.get("alias", ""),
124
+ _fwk=data.get("fwk", "PHYSICAL"),
125
+ _unit=data.get("unit", ""),
126
+ _name=data.get("_name", ""),
127
+ description=data.get("description", "")
128
+ )
129
+
130
+ def __eq__(self, other: object) -> bool:
131
+ """*__eq__()* Check equality of two Dimension objects.
132
+
133
+ Args:
134
+ other (object): The other object to compare.
135
+
136
+ Returns:
137
+ bool: True if equal, False otherwise.
138
+ """
139
+ if not isinstance(other, Dimension):
140
+ return NotImplemented
141
+ eq_sym = self._sym == other._sym
142
+ eq_fwk = self._fwk == other._fwk
143
+ eq_alias = self._alias == other._alias
144
+ eq_unit = self._unit == other._unit
145
+ # return (self._sym == other._sym and self._fwk == other._fwk)
146
+ return eq_sym and eq_fwk and eq_alias and eq_unit