tnfr 4.5.2__py3-none-any.whl → 7.0.0__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.
Potentially problematic release.
This version of tnfr might be problematic. Click here for more details.
- tnfr/__init__.py +275 -51
- tnfr/__init__.pyi +33 -0
- tnfr/_compat.py +10 -0
- tnfr/_generated_version.py +34 -0
- tnfr/_version.py +49 -0
- tnfr/_version.pyi +7 -0
- tnfr/alias.py +117 -31
- tnfr/alias.pyi +108 -0
- tnfr/cache.py +6 -572
- tnfr/cache.pyi +16 -0
- tnfr/callback_utils.py +16 -38
- tnfr/callback_utils.pyi +79 -0
- tnfr/cli/__init__.py +34 -14
- tnfr/cli/__init__.pyi +26 -0
- tnfr/cli/arguments.py +211 -28
- tnfr/cli/arguments.pyi +27 -0
- tnfr/cli/execution.py +470 -50
- tnfr/cli/execution.pyi +70 -0
- tnfr/cli/utils.py +18 -3
- tnfr/cli/utils.pyi +8 -0
- tnfr/config/__init__.py +13 -0
- tnfr/config/__init__.pyi +10 -0
- tnfr/{constants_glyphs.py → config/constants.py} +26 -20
- tnfr/config/constants.pyi +12 -0
- tnfr/config/feature_flags.py +83 -0
- tnfr/{config.py → config/init.py} +11 -7
- tnfr/config/init.pyi +8 -0
- tnfr/config/operator_names.py +93 -0
- tnfr/config/operator_names.pyi +28 -0
- tnfr/config/presets.py +84 -0
- tnfr/config/presets.pyi +7 -0
- tnfr/constants/__init__.py +80 -29
- tnfr/constants/__init__.pyi +92 -0
- tnfr/constants/aliases.py +31 -0
- tnfr/constants/core.py +4 -4
- tnfr/constants/core.pyi +17 -0
- tnfr/constants/init.py +1 -1
- tnfr/constants/init.pyi +12 -0
- tnfr/constants/metric.py +7 -15
- tnfr/constants/metric.pyi +19 -0
- tnfr/dynamics/__init__.py +165 -633
- tnfr/dynamics/__init__.pyi +82 -0
- tnfr/dynamics/adaptation.py +267 -0
- tnfr/dynamics/aliases.py +23 -0
- tnfr/dynamics/coordination.py +385 -0
- tnfr/dynamics/dnfr.py +2283 -400
- tnfr/dynamics/dnfr.pyi +24 -0
- tnfr/dynamics/integrators.py +406 -98
- tnfr/dynamics/integrators.pyi +34 -0
- tnfr/dynamics/runtime.py +881 -0
- tnfr/dynamics/sampling.py +10 -5
- tnfr/dynamics/sampling.pyi +7 -0
- tnfr/dynamics/selectors.py +719 -0
- tnfr/execution.py +70 -48
- tnfr/execution.pyi +45 -0
- tnfr/flatten.py +13 -9
- tnfr/flatten.pyi +21 -0
- tnfr/gamma.py +66 -53
- tnfr/gamma.pyi +34 -0
- tnfr/glyph_history.py +110 -52
- tnfr/glyph_history.pyi +35 -0
- tnfr/glyph_runtime.py +16 -0
- tnfr/glyph_runtime.pyi +9 -0
- tnfr/immutable.py +69 -28
- tnfr/immutable.pyi +34 -0
- tnfr/initialization.py +16 -16
- tnfr/initialization.pyi +65 -0
- tnfr/io.py +6 -240
- tnfr/io.pyi +16 -0
- tnfr/locking.pyi +7 -0
- tnfr/mathematics/__init__.py +81 -0
- tnfr/mathematics/backend.py +426 -0
- tnfr/mathematics/dynamics.py +398 -0
- tnfr/mathematics/epi.py +254 -0
- tnfr/mathematics/generators.py +222 -0
- tnfr/mathematics/metrics.py +119 -0
- tnfr/mathematics/operators.py +233 -0
- tnfr/mathematics/operators_factory.py +71 -0
- tnfr/mathematics/projection.py +78 -0
- tnfr/mathematics/runtime.py +173 -0
- tnfr/mathematics/spaces.py +247 -0
- tnfr/mathematics/transforms.py +292 -0
- tnfr/metrics/__init__.py +10 -10
- tnfr/metrics/__init__.pyi +20 -0
- tnfr/metrics/coherence.py +993 -324
- tnfr/metrics/common.py +23 -16
- tnfr/metrics/common.pyi +46 -0
- tnfr/metrics/core.py +251 -35
- tnfr/metrics/core.pyi +13 -0
- tnfr/metrics/diagnosis.py +708 -111
- tnfr/metrics/diagnosis.pyi +85 -0
- tnfr/metrics/export.py +27 -15
- tnfr/metrics/glyph_timing.py +232 -42
- tnfr/metrics/reporting.py +33 -22
- tnfr/metrics/reporting.pyi +12 -0
- tnfr/metrics/sense_index.py +987 -43
- tnfr/metrics/sense_index.pyi +9 -0
- tnfr/metrics/trig.py +214 -23
- tnfr/metrics/trig.pyi +13 -0
- tnfr/metrics/trig_cache.py +115 -22
- tnfr/metrics/trig_cache.pyi +10 -0
- tnfr/node.py +542 -136
- tnfr/node.pyi +178 -0
- tnfr/observers.py +152 -35
- tnfr/observers.pyi +31 -0
- tnfr/ontosim.py +23 -19
- tnfr/ontosim.pyi +28 -0
- tnfr/operators/__init__.py +601 -82
- tnfr/operators/__init__.pyi +45 -0
- tnfr/operators/definitions.py +513 -0
- tnfr/operators/definitions.pyi +78 -0
- tnfr/operators/grammar.py +760 -0
- tnfr/operators/jitter.py +107 -38
- tnfr/operators/jitter.pyi +11 -0
- tnfr/operators/registry.py +75 -0
- tnfr/operators/registry.pyi +13 -0
- tnfr/operators/remesh.py +149 -88
- tnfr/py.typed +0 -0
- tnfr/rng.py +46 -143
- tnfr/rng.pyi +14 -0
- tnfr/schemas/__init__.py +8 -0
- tnfr/schemas/grammar.json +94 -0
- tnfr/selector.py +25 -19
- tnfr/selector.pyi +19 -0
- tnfr/sense.py +72 -62
- tnfr/sense.pyi +23 -0
- tnfr/structural.py +522 -262
- tnfr/structural.pyi +69 -0
- tnfr/telemetry/__init__.py +35 -0
- tnfr/telemetry/cache_metrics.py +226 -0
- tnfr/telemetry/nu_f.py +423 -0
- tnfr/telemetry/nu_f.pyi +123 -0
- tnfr/telemetry/verbosity.py +37 -0
- tnfr/tokens.py +1 -3
- tnfr/tokens.pyi +36 -0
- tnfr/trace.py +270 -113
- tnfr/trace.pyi +40 -0
- tnfr/types.py +574 -6
- tnfr/types.pyi +331 -0
- tnfr/units.py +69 -0
- tnfr/units.pyi +16 -0
- tnfr/utils/__init__.py +217 -0
- tnfr/utils/__init__.pyi +202 -0
- tnfr/utils/cache.py +2395 -0
- tnfr/utils/cache.pyi +468 -0
- tnfr/utils/chunks.py +104 -0
- tnfr/utils/chunks.pyi +21 -0
- tnfr/{collections_utils.py → utils/data.py} +147 -90
- tnfr/utils/data.pyi +64 -0
- tnfr/utils/graph.py +85 -0
- tnfr/utils/graph.pyi +10 -0
- tnfr/utils/init.py +770 -0
- tnfr/utils/init.pyi +78 -0
- tnfr/utils/io.py +456 -0
- tnfr/{helpers → utils}/numeric.py +51 -24
- tnfr/utils/numeric.pyi +21 -0
- tnfr/validation/__init__.py +113 -0
- tnfr/validation/__init__.pyi +77 -0
- tnfr/validation/compatibility.py +95 -0
- tnfr/validation/compatibility.pyi +6 -0
- tnfr/validation/grammar.py +71 -0
- tnfr/validation/grammar.pyi +40 -0
- tnfr/validation/graph.py +138 -0
- tnfr/validation/graph.pyi +17 -0
- tnfr/validation/rules.py +281 -0
- tnfr/validation/rules.pyi +55 -0
- tnfr/validation/runtime.py +263 -0
- tnfr/validation/runtime.pyi +31 -0
- tnfr/validation/soft_filters.py +170 -0
- tnfr/validation/soft_filters.pyi +37 -0
- tnfr/validation/spectral.py +159 -0
- tnfr/validation/spectral.pyi +46 -0
- tnfr/validation/syntax.py +40 -0
- tnfr/validation/syntax.pyi +10 -0
- tnfr/validation/window.py +39 -0
- tnfr/validation/window.pyi +1 -0
- tnfr/viz/__init__.py +9 -0
- tnfr/viz/matplotlib.py +246 -0
- tnfr-7.0.0.dist-info/METADATA +179 -0
- tnfr-7.0.0.dist-info/RECORD +185 -0
- {tnfr-4.5.2.dist-info → tnfr-7.0.0.dist-info}/licenses/LICENSE.md +1 -1
- tnfr/grammar.py +0 -344
- tnfr/graph_utils.py +0 -84
- tnfr/helpers/__init__.py +0 -71
- tnfr/import_utils.py +0 -228
- tnfr/json_utils.py +0 -162
- tnfr/logging_utils.py +0 -116
- tnfr/presets.py +0 -60
- tnfr/validators.py +0 -84
- tnfr/value_utils.py +0 -59
- tnfr-4.5.2.dist-info/METADATA +0 -379
- tnfr-4.5.2.dist-info/RECORD +0 -67
- {tnfr-4.5.2.dist-info → tnfr-7.0.0.dist-info}/WHEEL +0 -0
- {tnfr-4.5.2.dist-info → tnfr-7.0.0.dist-info}/entry_points.txt +0 -0
- {tnfr-4.5.2.dist-info → tnfr-7.0.0.dist-info}/top_level.txt +0 -0
tnfr/constants/__init__.py
CHANGED
|
@@ -2,32 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Callable
|
|
6
|
-
from collections.abc import Mapping
|
|
7
5
|
import copy
|
|
6
|
+
from collections.abc import Mapping
|
|
8
7
|
from types import MappingProxyType
|
|
8
|
+
from typing import Callable, TypeVar, cast
|
|
9
9
|
|
|
10
|
+
from ..immutable import _is_immutable
|
|
11
|
+
from ..types import GraphLike, TNFRConfigValue
|
|
10
12
|
from .core import CORE_DEFAULTS, REMESH_DEFAULTS
|
|
11
13
|
from .init import INIT_DEFAULTS
|
|
12
14
|
from .metric import (
|
|
15
|
+
COHERENCE,
|
|
16
|
+
DIAGNOSIS,
|
|
17
|
+
GRAMMAR_CANON,
|
|
13
18
|
METRIC_DEFAULTS,
|
|
19
|
+
METRICS,
|
|
14
20
|
SIGMA,
|
|
15
21
|
TRACE,
|
|
16
|
-
METRICS,
|
|
17
|
-
GRAMMAR_CANON,
|
|
18
|
-
COHERENCE,
|
|
19
|
-
DIAGNOSIS,
|
|
20
22
|
)
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
T = TypeVar("T")
|
|
25
|
+
|
|
26
|
+
STATE_STABLE = "stable"
|
|
27
|
+
STATE_TRANSITION = "transition"
|
|
28
|
+
STATE_DISSONANT = "dissonant"
|
|
29
|
+
|
|
30
|
+
CANONICAL_STATE_TOKENS = frozenset({STATE_STABLE, STATE_TRANSITION, STATE_DISSONANT})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def normalise_state_token(token: str) -> str:
|
|
34
|
+
"""Return the canonical English token for ``token``.
|
|
35
|
+
|
|
36
|
+
The helper now enforces the English identifiers exclusively. Values that
|
|
37
|
+
do not match the canonical set raise :class:`ValueError` so callers can
|
|
38
|
+
surface explicit migration errors when legacy payloads are encountered.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
if not isinstance(token, str):
|
|
42
|
+
raise TypeError("state token must be a string")
|
|
43
|
+
|
|
44
|
+
stripped = token.strip()
|
|
45
|
+
lowered = stripped.lower()
|
|
46
|
+
|
|
47
|
+
if stripped in CANONICAL_STATE_TOKENS:
|
|
48
|
+
return stripped
|
|
49
|
+
|
|
50
|
+
if lowered in CANONICAL_STATE_TOKENS:
|
|
51
|
+
return lowered
|
|
52
|
+
|
|
53
|
+
raise ValueError(
|
|
54
|
+
"state token must be one of 'stable', 'transition', or 'dissonant'"
|
|
55
|
+
)
|
|
56
|
+
|
|
23
57
|
|
|
24
58
|
try: # pragma: no cover - optional dependency
|
|
25
|
-
from ..
|
|
59
|
+
from ..utils import ensure_node_offset_map as _ensure_node_offset_map
|
|
26
60
|
except ImportError: # noqa: BLE001 - allow any import error
|
|
27
|
-
|
|
61
|
+
_ensure_node_offset_map = None
|
|
62
|
+
|
|
63
|
+
ensure_node_offset_map: Callable[[GraphLike], None] | None = _ensure_node_offset_map
|
|
28
64
|
|
|
29
|
-
#
|
|
30
|
-
DEFAULT_SECTIONS: Mapping[str, Mapping[str,
|
|
65
|
+
# Exported sections
|
|
66
|
+
DEFAULT_SECTIONS: Mapping[str, Mapping[str, TNFRConfigValue]] = MappingProxyType(
|
|
31
67
|
{
|
|
32
68
|
"core": CORE_DEFAULTS,
|
|
33
69
|
"init": INIT_DEFAULTS,
|
|
@@ -36,21 +72,23 @@ DEFAULT_SECTIONS: Mapping[str, Mapping[str, Any]] = MappingProxyType(
|
|
|
36
72
|
}
|
|
37
73
|
)
|
|
38
74
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
DEFAULTS: Mapping[str,
|
|
75
|
+
# Combined exported dictionary
|
|
76
|
+
# Merge the dictionaries from lowest to highest priority so that
|
|
77
|
+
# ``METRIC_DEFAULTS`` overrides the rest, mirroring the previous ``ChainMap``
|
|
78
|
+
# behaviour.
|
|
79
|
+
DEFAULTS: Mapping[str, TNFRConfigValue] = MappingProxyType(
|
|
44
80
|
CORE_DEFAULTS | INIT_DEFAULTS | REMESH_DEFAULTS | METRIC_DEFAULTS
|
|
45
81
|
)
|
|
46
82
|
|
|
47
83
|
# -------------------------
|
|
48
|
-
#
|
|
84
|
+
# Utilities
|
|
49
85
|
# -------------------------
|
|
50
86
|
|
|
51
87
|
|
|
52
88
|
def inject_defaults(
|
|
53
|
-
G
|
|
89
|
+
G: GraphLike,
|
|
90
|
+
defaults: Mapping[str, TNFRConfigValue] = DEFAULTS,
|
|
91
|
+
override: bool = False,
|
|
54
92
|
) -> None:
|
|
55
93
|
"""Inject ``defaults`` into ``G.graph``.
|
|
56
94
|
|
|
@@ -63,13 +101,15 @@ def inject_defaults(
|
|
|
63
101
|
G.graph.setdefault("_tnfr_defaults_attached", False)
|
|
64
102
|
for k, v in defaults.items():
|
|
65
103
|
if override or k not in G.graph:
|
|
66
|
-
G.graph[k] =
|
|
104
|
+
G.graph[k] = (
|
|
105
|
+
v if _is_immutable(v) else cast(TNFRConfigValue, copy.deepcopy(v))
|
|
106
|
+
)
|
|
67
107
|
G.graph["_tnfr_defaults_attached"] = True
|
|
68
108
|
if ensure_node_offset_map is not None:
|
|
69
109
|
ensure_node_offset_map(G)
|
|
70
110
|
|
|
71
111
|
|
|
72
|
-
def merge_overrides(G, **overrides) -> None:
|
|
112
|
+
def merge_overrides(G: GraphLike, **overrides: TNFRConfigValue) -> None:
|
|
73
113
|
"""Apply specific changes to ``G.graph``.
|
|
74
114
|
|
|
75
115
|
Non-immutable values are deep-copied to avoid shared state with
|
|
@@ -77,20 +117,26 @@ def merge_overrides(G, **overrides) -> None:
|
|
|
77
117
|
"""
|
|
78
118
|
for key, value in overrides.items():
|
|
79
119
|
if key not in DEFAULTS:
|
|
80
|
-
raise KeyError(f"
|
|
81
|
-
G.graph[key] =
|
|
120
|
+
raise KeyError(f"Unknown parameter: '{key}'")
|
|
121
|
+
G.graph[key] = (
|
|
122
|
+
value
|
|
123
|
+
if _is_immutable(value)
|
|
124
|
+
else cast(TNFRConfigValue, copy.deepcopy(value))
|
|
125
|
+
)
|
|
82
126
|
|
|
83
127
|
|
|
84
|
-
def get_param(G, key: str):
|
|
128
|
+
def get_param(G: GraphLike, key: str) -> TNFRConfigValue:
|
|
85
129
|
"""Retrieve a parameter from ``G.graph`` or fall back to defaults."""
|
|
86
130
|
if key in G.graph:
|
|
87
131
|
return G.graph[key]
|
|
88
132
|
if key not in DEFAULTS:
|
|
89
|
-
raise KeyError(f"
|
|
133
|
+
raise KeyError(f"Unknown parameter: '{key}'")
|
|
90
134
|
return DEFAULTS[key]
|
|
91
135
|
|
|
92
136
|
|
|
93
|
-
def get_graph_param(
|
|
137
|
+
def get_graph_param(
|
|
138
|
+
G: GraphLike, key: str, cast: Callable[[object], T] = float
|
|
139
|
+
) -> T | None:
|
|
94
140
|
"""Return ``key`` from ``G.graph`` applying ``cast``.
|
|
95
141
|
|
|
96
142
|
The ``cast`` argument must be a function (e.g. ``float``, ``int``,
|
|
@@ -101,14 +147,14 @@ def get_graph_param(G, key: str, cast: Callable[[Any], Any] = float):
|
|
|
101
147
|
return None if val is None else cast(val)
|
|
102
148
|
|
|
103
149
|
|
|
104
|
-
#
|
|
150
|
+
# Canonical keys with ASCII spellings
|
|
105
151
|
VF_KEY = "νf"
|
|
106
|
-
THETA_KEY = "
|
|
152
|
+
THETA_KEY = "theta"
|
|
107
153
|
|
|
108
|
-
#
|
|
154
|
+
# Alias map for node attributes
|
|
109
155
|
ALIASES: dict[str, tuple[str, ...]] = {
|
|
110
156
|
"VF": (VF_KEY, "nu_f", "nu-f", "nu", "freq", "frequency"),
|
|
111
|
-
"THETA": (THETA_KEY, "
|
|
157
|
+
"THETA": (THETA_KEY, "phase"),
|
|
112
158
|
"DNFR": ("ΔNFR", "delta_nfr", "dnfr"),
|
|
113
159
|
"EPI": ("EPI", "psi", "PSI", "value"),
|
|
114
160
|
"EPI_KIND": ("EPI_kind", "epi_kind", "source_glyph"),
|
|
@@ -171,4 +217,9 @@ __all__ = (
|
|
|
171
217
|
"dVF_PRIMARY",
|
|
172
218
|
"D2VF_PRIMARY",
|
|
173
219
|
"dSI_PRIMARY",
|
|
220
|
+
"STATE_STABLE",
|
|
221
|
+
"STATE_TRANSITION",
|
|
222
|
+
"STATE_DISSONANT",
|
|
223
|
+
"CANONICAL_STATE_TOKENS",
|
|
224
|
+
"normalise_state_token",
|
|
174
225
|
)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Callable, TypeVar
|
|
5
|
+
|
|
6
|
+
from ..types import GraphLike, TNFRConfigValue
|
|
7
|
+
from .core import CORE_DEFAULTS as CORE_DEFAULTS
|
|
8
|
+
from .core import REMESH_DEFAULTS as REMESH_DEFAULTS
|
|
9
|
+
from .init import INIT_DEFAULTS as INIT_DEFAULTS
|
|
10
|
+
from .metric import COHERENCE as COHERENCE
|
|
11
|
+
from .metric import DIAGNOSIS as DIAGNOSIS
|
|
12
|
+
from .metric import GRAMMAR_CANON as GRAMMAR_CANON
|
|
13
|
+
from .metric import METRIC_DEFAULTS as METRIC_DEFAULTS
|
|
14
|
+
from .metric import METRICS as METRICS
|
|
15
|
+
from .metric import SIGMA as SIGMA
|
|
16
|
+
from .metric import TRACE as TRACE
|
|
17
|
+
|
|
18
|
+
T = TypeVar("T")
|
|
19
|
+
|
|
20
|
+
__all__ = (
|
|
21
|
+
"CORE_DEFAULTS",
|
|
22
|
+
"INIT_DEFAULTS",
|
|
23
|
+
"REMESH_DEFAULTS",
|
|
24
|
+
"METRIC_DEFAULTS",
|
|
25
|
+
"SIGMA",
|
|
26
|
+
"TRACE",
|
|
27
|
+
"METRICS",
|
|
28
|
+
"GRAMMAR_CANON",
|
|
29
|
+
"COHERENCE",
|
|
30
|
+
"DIAGNOSIS",
|
|
31
|
+
"DEFAULTS",
|
|
32
|
+
"DEFAULT_SECTIONS",
|
|
33
|
+
"ALIASES",
|
|
34
|
+
"inject_defaults",
|
|
35
|
+
"merge_overrides",
|
|
36
|
+
"get_param",
|
|
37
|
+
"get_graph_param",
|
|
38
|
+
"get_aliases",
|
|
39
|
+
"VF_KEY",
|
|
40
|
+
"THETA_KEY",
|
|
41
|
+
"VF_PRIMARY",
|
|
42
|
+
"THETA_PRIMARY",
|
|
43
|
+
"DNFR_PRIMARY",
|
|
44
|
+
"EPI_PRIMARY",
|
|
45
|
+
"EPI_KIND_PRIMARY",
|
|
46
|
+
"SI_PRIMARY",
|
|
47
|
+
"dEPI_PRIMARY",
|
|
48
|
+
"D2EPI_PRIMARY",
|
|
49
|
+
"dVF_PRIMARY",
|
|
50
|
+
"D2VF_PRIMARY",
|
|
51
|
+
"dSI_PRIMARY",
|
|
52
|
+
"STATE_STABLE",
|
|
53
|
+
"STATE_TRANSITION",
|
|
54
|
+
"STATE_DISSONANT",
|
|
55
|
+
"CANONICAL_STATE_TOKENS",
|
|
56
|
+
"normalise_state_token",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
ensure_node_offset_map: Callable[[GraphLike], None] | None
|
|
60
|
+
DEFAULT_SECTIONS: Mapping[str, Mapping[str, TNFRConfigValue]]
|
|
61
|
+
DEFAULTS: Mapping[str, TNFRConfigValue]
|
|
62
|
+
ALIASES: dict[str, tuple[str, ...]]
|
|
63
|
+
VF_KEY: str
|
|
64
|
+
THETA_KEY: str
|
|
65
|
+
VF_PRIMARY: str
|
|
66
|
+
THETA_PRIMARY: str
|
|
67
|
+
DNFR_PRIMARY: str
|
|
68
|
+
EPI_PRIMARY: str
|
|
69
|
+
EPI_KIND_PRIMARY: str
|
|
70
|
+
SI_PRIMARY: str
|
|
71
|
+
dEPI_PRIMARY: str
|
|
72
|
+
D2EPI_PRIMARY: str
|
|
73
|
+
dVF_PRIMARY: str
|
|
74
|
+
D2VF_PRIMARY: str
|
|
75
|
+
dSI_PRIMARY: str
|
|
76
|
+
STATE_STABLE: str
|
|
77
|
+
STATE_TRANSITION: str
|
|
78
|
+
STATE_DISSONANT: str
|
|
79
|
+
CANONICAL_STATE_TOKENS: frozenset[str]
|
|
80
|
+
|
|
81
|
+
def inject_defaults(
|
|
82
|
+
G: GraphLike,
|
|
83
|
+
defaults: Mapping[str, TNFRConfigValue] = ...,
|
|
84
|
+
override: bool = ...,
|
|
85
|
+
) -> None: ...
|
|
86
|
+
def merge_overrides(G: GraphLike, **overrides: TNFRConfigValue) -> None: ...
|
|
87
|
+
def get_param(G: GraphLike, key: str) -> TNFRConfigValue: ...
|
|
88
|
+
def get_graph_param(
|
|
89
|
+
G: GraphLike, key: str, cast: Callable[[object], T] = ...
|
|
90
|
+
) -> T | None: ...
|
|
91
|
+
def get_aliases(key: str) -> tuple[str, ...]: ...
|
|
92
|
+
def normalise_state_token(token: str) -> str: ...
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Shared alias constants for TNFR attributes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from . import get_aliases
|
|
6
|
+
|
|
7
|
+
ALIAS_VF = get_aliases("VF")
|
|
8
|
+
ALIAS_THETA = get_aliases("THETA")
|
|
9
|
+
ALIAS_DNFR = get_aliases("DNFR")
|
|
10
|
+
ALIAS_EPI = get_aliases("EPI")
|
|
11
|
+
ALIAS_EPI_KIND = get_aliases("EPI_KIND")
|
|
12
|
+
ALIAS_SI = get_aliases("SI")
|
|
13
|
+
ALIAS_DEPI = get_aliases("DEPI")
|
|
14
|
+
ALIAS_D2EPI = get_aliases("D2EPI")
|
|
15
|
+
ALIAS_DVF = get_aliases("DVF")
|
|
16
|
+
ALIAS_D2VF = get_aliases("D2VF")
|
|
17
|
+
ALIAS_DSI = get_aliases("DSI")
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"ALIAS_VF",
|
|
21
|
+
"ALIAS_THETA",
|
|
22
|
+
"ALIAS_DNFR",
|
|
23
|
+
"ALIAS_EPI",
|
|
24
|
+
"ALIAS_EPI_KIND",
|
|
25
|
+
"ALIAS_SI",
|
|
26
|
+
"ALIAS_DEPI",
|
|
27
|
+
"ALIAS_D2EPI",
|
|
28
|
+
"ALIAS_DVF",
|
|
29
|
+
"ALIAS_D2VF",
|
|
30
|
+
"ALIAS_DSI",
|
|
31
|
+
]
|
tnfr/constants/core.py
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from dataclasses import
|
|
6
|
-
from typing import Any, Mapping
|
|
5
|
+
from dataclasses import asdict, dataclass, field
|
|
7
6
|
from types import MappingProxyType
|
|
8
|
-
|
|
7
|
+
from typing import Any, Mapping
|
|
9
8
|
|
|
10
9
|
SELECTOR_THRESHOLD_DEFAULTS: Mapping[str, float] = MappingProxyType(
|
|
11
10
|
{
|
|
@@ -72,6 +71,7 @@ class CoreDefaults:
|
|
|
72
71
|
GLYPH_SELECTOR_MARGIN: float = 0.05
|
|
73
72
|
VF_ADAPT_TAU: int = 5
|
|
74
73
|
VF_ADAPT_MU: float = 0.1
|
|
74
|
+
HZ_STR_BRIDGE: float = 1.0
|
|
75
75
|
GLYPH_FACTORS: dict[str, float] = field(
|
|
76
76
|
default_factory=lambda: {
|
|
77
77
|
"AL_boost": 0.05,
|
|
@@ -134,7 +134,7 @@ class RemeshDefaults:
|
|
|
134
134
|
EPS_DNFR_STABLE: float = 1e-3
|
|
135
135
|
EPS_DEPI_STABLE: float = 1e-3
|
|
136
136
|
FRACTION_STABLE_REMESH: float = 0.80
|
|
137
|
-
|
|
137
|
+
REMESH_COOLDOWN_WINDOW: int = 20
|
|
138
138
|
REMESH_COOLDOWN_TS: float = 0.0
|
|
139
139
|
REMESH_REQUIRE_STABILITY: bool = True
|
|
140
140
|
REMESH_STABILITY_WINDOW: int = 25
|
tnfr/constants/core.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
__all__: Any
|
|
4
|
+
|
|
5
|
+
def __getattr__(name: str) -> Any: ...
|
|
6
|
+
|
|
7
|
+
CORE_DEFAULTS: Any
|
|
8
|
+
CoreDefaults: Any
|
|
9
|
+
Mapping: Any
|
|
10
|
+
MappingProxyType: Any
|
|
11
|
+
REMESH_DEFAULTS: Any
|
|
12
|
+
RemeshDefaults: Any
|
|
13
|
+
SELECTOR_THRESHOLD_DEFAULTS: Any
|
|
14
|
+
annotations: Any
|
|
15
|
+
asdict: Any
|
|
16
|
+
dataclass: Any
|
|
17
|
+
field: Any
|
tnfr/constants/init.py
CHANGED
tnfr/constants/init.pyi
ADDED
tnfr/constants/metric.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from dataclasses import
|
|
6
|
-
from typing import Any
|
|
5
|
+
from dataclasses import asdict, dataclass, field
|
|
7
6
|
from types import MappingProxyType
|
|
7
|
+
from typing import Any
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@dataclass(frozen=True, slots=True)
|
|
@@ -27,7 +27,7 @@ class MetricDefaults:
|
|
|
27
27
|
default_factory=lambda: {
|
|
28
28
|
"enabled": True,
|
|
29
29
|
"weight": "Si", # "Si" | "EPI" | "1"
|
|
30
|
-
"smooth": 0.0, # EMA
|
|
30
|
+
"smooth": 0.0, # EMA over the global vector (0=off)
|
|
31
31
|
"history_key": "sigma_global",
|
|
32
32
|
"per_node": False,
|
|
33
33
|
}
|
|
@@ -35,18 +35,7 @@ class MetricDefaults:
|
|
|
35
35
|
TRACE: dict[str, Any] = field(
|
|
36
36
|
default_factory=lambda: {
|
|
37
37
|
"enabled": True,
|
|
38
|
-
"
|
|
39
|
-
"gamma",
|
|
40
|
-
"grammar",
|
|
41
|
-
"selector",
|
|
42
|
-
"dnfr_weights",
|
|
43
|
-
"si_weights",
|
|
44
|
-
"callbacks",
|
|
45
|
-
"thol_open_nodes",
|
|
46
|
-
"sigma",
|
|
47
|
-
"kuramoto",
|
|
48
|
-
"glyph_counts",
|
|
49
|
-
],
|
|
38
|
+
"verbosity": "debug",
|
|
50
39
|
"history_key": "trace_meta",
|
|
51
40
|
}
|
|
52
41
|
)
|
|
@@ -55,6 +44,8 @@ class MetricDefaults:
|
|
|
55
44
|
"enabled": True,
|
|
56
45
|
"save_by_node": True,
|
|
57
46
|
"normalize_series": False,
|
|
47
|
+
"n_jobs": 1,
|
|
48
|
+
"verbosity": "debug",
|
|
58
49
|
}
|
|
59
50
|
)
|
|
60
51
|
GRAMMAR_CANON: dict[str, Any] = field(
|
|
@@ -76,6 +67,7 @@ class MetricDefaults:
|
|
|
76
67
|
"self_on_diag": True,
|
|
77
68
|
"store_mode": "sparse",
|
|
78
69
|
"threshold": 0.0,
|
|
70
|
+
"n_jobs": 1,
|
|
79
71
|
"history_key": "W_sparse",
|
|
80
72
|
"Wi_history_key": "W_i",
|
|
81
73
|
"stats_history_key": "W_stats",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
__all__: Any
|
|
4
|
+
|
|
5
|
+
def __getattr__(name: str) -> Any: ...
|
|
6
|
+
|
|
7
|
+
COHERENCE: Any
|
|
8
|
+
DIAGNOSIS: Any
|
|
9
|
+
GRAMMAR_CANON: Any
|
|
10
|
+
METRICS: Any
|
|
11
|
+
METRIC_DEFAULTS: Any
|
|
12
|
+
MappingProxyType: Any
|
|
13
|
+
MetricDefaults: Any
|
|
14
|
+
SIGMA: Any
|
|
15
|
+
TRACE: Any
|
|
16
|
+
annotations: Any
|
|
17
|
+
asdict: Any
|
|
18
|
+
dataclass: Any
|
|
19
|
+
field: Any
|