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
pydasa/core/setup.py ADDED
@@ -0,0 +1,269 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Module config.py
4
+ ===========================================
5
+
6
+ Configuration module for basic *PyDASA* configuration parameters related to Dimensional Analysis (DA) of complex phenomena.
7
+
8
+ This module provides type-safe configuration through Enums and frozen dataclasses, replacing the previous mutable dictionary-based approach with immutable, type-checked alternatives.
9
+
10
+ NOTE: in the future the enum should be configurated via external files (e.g., JSON, YAML) to allow user customization.
11
+
12
+ Key Features:
13
+ - Type-safe Enum definitions for frameworks, categories, and modes
14
+ - Immutable configuration via frozen dataclass with singleton pattern
15
+ - Backward compatibility with legacy dict-based access
16
+
17
+ Supported Frameworks:
18
+ - PHYSICAL: Traditional physical dimensional framework.
19
+ - COMPUTATION: Computer science dimensional framework.
20
+ - SOFTWARE: Software architecture dimensional framework.
21
+ - CUSTOM: User-defined dimensional framework.
22
+
23
+ Supported Variable Categories:
24
+ - IN: Input variables influencing the system.
25
+ - OUT: Output variables representing analysis results.
26
+ - CTRL: Control variables constraining the system.
27
+
28
+ Supported Analysis Modes:
29
+ - SYM: Analysis for symbolic processable Parameters (e.g., 'x + y').
30
+ - NUM: Analysis for numeric Variables (e.g., 1.0, 2.5).
31
+
32
+ *IMPORTANT* Based on:
33
+ # H.Gorter, *Dimensionalanalyse: Eine Theoririe der physikalischen Dimensionen mit Anwendungen*
34
+ """
35
+ # native python modules
36
+ from enum import Enum
37
+ # dataclass imports
38
+ from dataclasses import dataclass, field
39
+ # data type imports
40
+ from typing import ClassVar
41
+
42
+ # custom modules
43
+ from pydasa.core.io import Path, load # , save
44
+ from pydasa.core.constants import DFLT_CFG_FOLDER, DFLT_CFG_FILE
45
+
46
+ # checking custom modules
47
+ assert load
48
+ assert DFLT_CFG_FOLDER
49
+ assert DFLT_CFG_FILE
50
+
51
+ # =============================================================================
52
+ # *PyDASA* Enum Definitions
53
+ # =============================================================================
54
+
55
+
56
+ class Frameworks(str, Enum):
57
+ """**Frameworks** Enum for Fundamental Dimensional Units (FDUs) frameworks in *PyDASA*.
58
+
59
+ Purpose:
60
+ - Defines the dimensional frameworks supported in *PyDASA*.
61
+
62
+ Args:
63
+ str (class): Python native str class.
64
+ Enum (class): Python native Enum class.
65
+
66
+ Returns:
67
+ Frameworks: Enum member representing the FDU framework.
68
+ """
69
+
70
+ PHYSICAL = "PHYSICAL"
71
+ COMPUTATION = "COMPUTATION"
72
+ SOFTWARE = "SOFTWARE"
73
+ CUSTOM = "CUSTOM"
74
+
75
+ @property
76
+ def description(self) -> str:
77
+ """*description* Get human-readable description of the framework.
78
+
79
+ Returns:
80
+ str: Human-readable framework's description.
81
+ """
82
+
83
+ descriptions = {
84
+ Frameworks.PHYSICAL: "Traditional physical dimensional framework (e.g., Length, Mass, Time).",
85
+ Frameworks.COMPUTATION: "Computer science dimensional framework (e.g., Time, Space, Complexity).",
86
+ Frameworks.SOFTWARE: "Software architecture dimensional framework (e.g., Time, Data, Connectivity).",
87
+ Frameworks.CUSTOM: "User-defined dimensional framework for specific use cases.",
88
+ }
89
+ return descriptions[self]
90
+
91
+
92
+ class VarCardinality(str, Enum):
93
+ """**VarCardinality** Enum for Variable cardinality in *PyDASA*.
94
+
95
+ Purpose:
96
+ - Defines the variable categories supported in *PyDASA*.
97
+ - Used to classify variables in the dimensional matrix.
98
+
99
+ Args:
100
+ str (class): Python native str class.
101
+ Enum (class): Python native Enum class.
102
+
103
+ Returns:
104
+ VarCardinality: Enum member representing the variable cardinality.
105
+ """
106
+ IN = "IN"
107
+ OUT = "OUT"
108
+ CTRL = "CTRL"
109
+
110
+ @property
111
+ def description(self) -> str:
112
+ """*description* Get human-readable description of the variable cardinality.
113
+
114
+ Returns:
115
+ str: Human-readable variable cardinality description.
116
+ """
117
+ descriptions = {
118
+ VarCardinality.IN: "Variables that influence the system (e.g., known inputs).",
119
+ VarCardinality.OUT: "Variable that represent the results of the analysis.",
120
+ VarCardinality.CTRL: "Variables used to control or constrain the system (e.g., constants).",
121
+ }
122
+ return descriptions[self]
123
+
124
+
125
+ class CoefCardinality(str, Enum):
126
+ """**CoefCardinality** Enum for Dimensionless Coefficient/Numbers/Groups (DC/DN/DG) cardinality in *PyDASA*.
127
+
128
+ Purpose:
129
+ - Defines the categories of dimensionless coefficients supported in *PyDASA*.
130
+ - Used to classify dimensionless coefficients in formulas and equations.
131
+ - Helps in organizing and managing dimensionless coefficients in the analysis.
132
+
133
+ Args:
134
+ str (class): Python native str class.
135
+ Enum (class): Python native Enum class.
136
+
137
+ Returns:
138
+ CoefCardinality: Enum member representing the coefficient cardinality.
139
+ """
140
+ COMPUTED = "COMPUTED"
141
+ DERIVED = "DERIVED"
142
+
143
+ @property
144
+ def description(self) -> str:
145
+ """*description* Get human-readable description of the coefficient cardinality.
146
+
147
+ Returns:
148
+ str: Human-readable coefficient cardinality description.
149
+ """
150
+ descriptions = {
151
+ CoefCardinality.COMPUTED: "Coefficients directly calculated using the Dimensional Matrix.",
152
+ CoefCardinality.DERIVED: "Coefficients obtained by combining or manipulating Computed Coefficients.",
153
+ }
154
+ return descriptions[self]
155
+
156
+
157
+ class AnaliticMode(str, Enum):
158
+ """**AnaliticMode** Enum for analysis modes (e.g. sensitivity analysis, Monte Carlo simulation) in *PyDASA*.
159
+
160
+ Purpose:
161
+ - Defines the analysis modes supported in *PyDASA*.
162
+ - Used to specify the type of analysis to be performed on variables, coefficients, or functions.
163
+
164
+ Args:
165
+ str (class): Python native str class.
166
+ Enum (class): python native Enum class.
167
+
168
+ Returns:
169
+ AnaliticMode: Enum member representing the analysis mode.
170
+ """
171
+ SYM = "SYM"
172
+ NUM = "NUM"
173
+
174
+ @property
175
+ def description(self) -> str:
176
+ descriptions = {
177
+ AnaliticMode.SYM: "Analysis for symbolic processable parameters (e.g., 'z = x + y').",
178
+ AnaliticMode.NUM: "analysis for numeric variable ranges (e.g., 1.0, 2.5).",
179
+ }
180
+ return descriptions[self]
181
+
182
+
183
+ # =============================================================================
184
+ # Immutable Configuration Singleton
185
+ # =============================================================================
186
+
187
+
188
+ @dataclass(frozen=True)
189
+ class PyDASAConfig:
190
+ """ **PyDASAConfig** Singleton class for PyDASA configuration. It uses dataclass decorator to freeze the data.
191
+
192
+ Returns:
193
+ PyDASAConfig: frozen singleton configuration instance.
194
+ """
195
+
196
+ # :attr: _instance
197
+ _instance: ClassVar["PyDASAConfig | None"] = None
198
+ """Singleton instance of PyDASAConfig."""
199
+
200
+ # :attr: SPT_FDU_FWKS
201
+ SPT_FDU_FWKS: dict = field(default_factory=dict)
202
+ """Supported Fundamental Dimensional Units (FDUs) frameworks and their configurations."""
203
+
204
+ def __post_init__(self):
205
+ """*__post_init__()* Post-initialization to load configuration from file."""
206
+ # Load configuration from default file (relative to this module's directory)
207
+ module_dir = Path(__file__).parent
208
+ fp = module_dir / DFLT_CFG_FOLDER / DFLT_CFG_FILE
209
+ cfg_data = load(fp)
210
+
211
+ # Since the dataclass is frozen, use object.__setattr__ to set attributes
212
+ object.__setattr__(self,
213
+ "SPT_FDU_FWKS",
214
+ cfg_data.get("frameworks", {}))
215
+
216
+ @classmethod
217
+ def get_instance(cls) -> "PyDASAConfig":
218
+ """*get_instance()* Get the singleton instance of PyDASAConfig.
219
+
220
+ Returns:
221
+ PyDASAConfig: Singleton instance of PyDASAConfig.
222
+ """
223
+ if cls._instance is None:
224
+ cls._instance = cls()
225
+ return cls._instance
226
+
227
+ @property
228
+ def frameworks(self) -> tuple[Frameworks, ...]:
229
+ """*frameworks* Get supported frameworks.
230
+
231
+ Returns:
232
+ tuple[Frameworks, ...]: Tuple of supported Frameworks.
233
+ """
234
+ return tuple(Frameworks)
235
+
236
+ @property
237
+ def parameter_cardinality(self) -> tuple[VarCardinality, ...]:
238
+ """*parameter_cardinality* Get supported variable cardinalities.
239
+
240
+ Returns:
241
+ tuple[VarCardinality, ...]: Tuple of supported VarCardinality.
242
+ """
243
+ return tuple(VarCardinality)
244
+
245
+ @property
246
+ def coefficient_cardinality(self) -> tuple[CoefCardinality, ...]:
247
+ """*coefficient_cardinality* Get supported coefficient cardinalities.
248
+
249
+ Returns:
250
+ tuple[CoefCardinality, ...]: Tuple of supported CoefCardinality.
251
+ """
252
+ return tuple(CoefCardinality)
253
+
254
+ @property
255
+ def analitic_modes(self) -> tuple[AnaliticMode, ...]:
256
+ """*analitic_modes* Get supported analysis modes.
257
+
258
+ Returns:
259
+ tuple[AnaliticMode, ...]: Tuple of supported AnaliticMode.
260
+ """
261
+ return tuple(AnaliticMode)
262
+
263
+
264
+ # Get singleton instance for configuration
265
+ # :attr: PYDASA_CFG
266
+ PYDASA_CFG: PyDASAConfig = PyDASAConfig()
267
+ """
268
+ Singleton instance of PyDASAConfig for accessing global configuration.
269
+ """
File without changes