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-4.5.2.dist-info/METADATA
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tnfr
|
|
3
|
-
Version: 4.5.2
|
|
4
|
-
Summary: Modular structural-based dynamics on networks.
|
|
5
|
-
Author: fmg
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://pypi.org/project/tnfr/
|
|
8
|
-
Project-URL: Repository, https://github.com/fermga/Teoria-de-la-naturaleza-fractal-resonante-TNFR-
|
|
9
|
-
Project-URL: GPT, https://chatgpt.com/g/g-67abc78885a88191b2d67f94fd60dc97-tnfr-teoria-de-la-naturaleza-fractal-resonante
|
|
10
|
-
Keywords: TNFR,complex systems,fractals,resonance,networks,structural dynamics,structural analysis
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
-
Classifier: Operating System :: OS Independent
|
|
19
|
-
Classifier: Intended Audience :: Science/Research
|
|
20
|
-
Requires-Python: >=3.9
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
License-File: LICENSE.md
|
|
23
|
-
Requires-Dist: networkx>=2.6
|
|
24
|
-
Requires-Dist: cachetools>=5
|
|
25
|
-
Provides-Extra: numpy
|
|
26
|
-
Requires-Dist: numpy>=1.24; extra == "numpy"
|
|
27
|
-
Provides-Extra: yaml
|
|
28
|
-
Requires-Dist: pyyaml>=6.0; extra == "yaml"
|
|
29
|
-
Provides-Extra: orjson
|
|
30
|
-
Requires-Dist: orjson>=3; extra == "orjson"
|
|
31
|
-
Provides-Extra: test
|
|
32
|
-
Requires-Dist: pytest>=7; extra == "test"
|
|
33
|
-
Requires-Dist: pydocstyle>=6; extra == "test"
|
|
34
|
-
Dynamic: license-file
|
|
35
|
-
|
|
36
|
-
# TNFR Python Engine
|
|
37
|
-
|
|
38
|
-
Engine for **modeling, simulation and measurement** of multiscale structural coherence through **structural operators** (emission, reception, coherence, dissonance, coupling, resonance, silence, expansion, contraction, self‑organization, mutation, transition, recursivity).
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## What is `tnfr`?
|
|
43
|
-
|
|
44
|
-
`tnfr` is a Python library to **operate with form**: build nodes, couple them into networks, and **modulate their coherence** over time using structural operators. It does not describe “things”; it **activates processes**. Its theoretical basis is the *Teoria de la Naturaleza Fractal Resonante (TNFR)*, which understands reality as **networks of coherence** that persist because they **resonate**.
|
|
45
|
-
|
|
46
|
-
In practical terms, `tnfr` lets you:
|
|
47
|
-
|
|
48
|
-
* Model **Resonant Fractal Nodes (NFR)** with parameters for **frequency** (νf), **phase** (θ), and **form** (EPI). Use the ASCII constants `VF_KEY` and `THETA_KEY` to reference these attributes programmatically; the Unicode names remain available as aliases.
|
|
49
|
-
* Apply **structural operators** to start, stabilize, propagate, or reconfigure coherence.
|
|
50
|
-
* **Simulate** nodal dynamics with discrete/continuous integrators.
|
|
51
|
-
* **Measure** global coherence C(t), nodal gradient ΔNFR, and the **Sense Index** (Si).
|
|
52
|
-
* **Visualize** states and trajectories (coupling matrices, C(t) curves, graphs).
|
|
53
|
-
|
|
54
|
-
A form emerges and persists when **internal reorganization** (ΔNFR) **resonates** with the node’s **frequency** (νf).
|
|
55
|
-
|
|
56
|
-
## Quick start
|
|
57
|
-
|
|
58
|
-
### Desde Python
|
|
59
|
-
|
|
60
|
-
```python
|
|
61
|
-
from tnfr import create_nfr, run_sequence
|
|
62
|
-
from tnfr.structural import (
|
|
63
|
-
Emision,
|
|
64
|
-
Recepcion,
|
|
65
|
-
Coherencia,
|
|
66
|
-
Resonancia,
|
|
67
|
-
Silencio,
|
|
68
|
-
)
|
|
69
|
-
from tnfr.metrics.common import compute_coherence
|
|
70
|
-
from tnfr.metrics.sense_index import compute_Si
|
|
71
|
-
|
|
72
|
-
G, nodo = create_nfr("A", epi=0.2, vf=1.0, theta=0.0)
|
|
73
|
-
ops = [Emision(), Recepcion(), Coherencia(), Resonancia(), Silencio()]
|
|
74
|
-
run_sequence(G, nodo, ops)
|
|
75
|
-
|
|
76
|
-
C, delta_nfr_medio, depi_medio = compute_coherence(G, return_means=True)
|
|
77
|
-
si_por_nodo = compute_Si(G)
|
|
78
|
-
print(f"C(t)={C:.3f}, ΔNFR̄={delta_nfr_medio:.3f}, dEPI/dt̄={depi_medio:.3f}, Si={si_por_nodo[nodo]:.3f}")
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
La secuencia respeta la ecuación nodal porque `create_nfr` inicializa el nodo con su **νf** y fase, y `run_sequence` valida la gramática TNFR antes de aplicar los operadores en el orden provisto. Tras cada operador invoca el gancho `compute_delta_nfr` del grafo para recalcular únicamente **ΔNFR** (por defecto usa `dnfr_epi_vf_mixed`, que mezcla EPI y νf sin alterar la fase). La fase solo cambiará si los propios operadores la modifican o si se ejecutan pasos dinámicos posteriores (por ejemplo `tnfr.dynamics.step` o `coordinate_global_local_phase`). Cuando necesites sincronización de fase automática, utiliza el ciclo de dinámica completo (`tnfr.dynamics.step`/`tnfr.dynamics.run`) o invoca explícitamente los coordinadores de fase después de `run_sequence`. Esa telemetría permite medir **C(t)** y **Si**, adelantando lo que se desarrolla en [Key concepts (operational summary)](#key-concepts-operational-summary) y [Main metrics](#main-metrics).
|
|
82
|
-
|
|
83
|
-
### Desde la línea de comandos
|
|
84
|
-
|
|
85
|
-
Archivo `secuencia.json`:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
[
|
|
89
|
-
"emision",
|
|
90
|
-
"recepcion",
|
|
91
|
-
"coherencia",
|
|
92
|
-
"resonancia",
|
|
93
|
-
"silencio"
|
|
94
|
-
]
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
tnfr sequence --nodes 1 --sequence-file secuencia.json --save-history historia.json
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
El subcomando `sequence` carga la trayectoria canónica del archivo JSON, ejecuta los operadores con la gramática oficial y actualiza **νf**, **ΔNFR** y fase usando los mismos ganchos que la API de Python. Al finalizar se vuelcan en `historia.json` las series de **C(t)**, **ΔNFR** medio y **Si**, que amplían las secciones sobre [operadores estructurales](#key-concepts-operational-summary) y [métricas](#main-metrics).
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## Installation
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
pip install tnfr
|
|
109
|
-
```
|
|
110
|
-
* https://pypi.org/project/tnfr/
|
|
111
|
-
* Requires **Python ≥ 3.9**.
|
|
112
|
-
* Install extras:
|
|
113
|
-
* NumPy: `pip install tnfr[numpy]`
|
|
114
|
-
* YAML: `pip install tnfr[yaml]`
|
|
115
|
-
* orjson (faster JSON serialization): `pip install tnfr[orjson]`
|
|
116
|
-
* All: `pip install tnfr[numpy,yaml,orjson]`
|
|
117
|
-
* When `orjson` is unavailable the engine falls back to Python's built-in
|
|
118
|
-
`json` module.
|
|
119
|
-
|
|
120
|
-
### Optional imports with cache
|
|
121
|
-
|
|
122
|
-
Use ``tnfr.cached_import`` to load optional dependencies and cache the result
|
|
123
|
-
via a process-wide LRU cache. Missing modules (or attributes) yield ``None``
|
|
124
|
-
without triggering repeated imports. The helper records failures and emits a
|
|
125
|
-
single warning per module to keep logs tidy. When optional packages are
|
|
126
|
-
installed at runtime call ``prune_failed_imports`` to clear the consolidated
|
|
127
|
-
failure/warning registry before retrying:
|
|
128
|
-
|
|
129
|
-
```python
|
|
130
|
-
from tnfr import cached_import, prune_failed_imports
|
|
131
|
-
|
|
132
|
-
np = cached_import("numpy")
|
|
133
|
-
safe_load = cached_import("yaml", "safe_load")
|
|
134
|
-
|
|
135
|
-
# provide a shared cache with an explicit lock
|
|
136
|
-
from cachetools import TTLCache
|
|
137
|
-
import threading
|
|
138
|
-
|
|
139
|
-
cache = TTLCache(32, 60)
|
|
140
|
-
lock = threading.Lock()
|
|
141
|
-
cached_import("numpy", cache=cache, lock=lock)
|
|
142
|
-
|
|
143
|
-
# clear caches after installing a dependency at runtime
|
|
144
|
-
cached_import.cache_clear()
|
|
145
|
-
prune_failed_imports()
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Tests
|
|
149
|
-
|
|
150
|
-
Run the test suite from the project root using the helper script, which sets
|
|
151
|
-
the necessary `PYTHONPATH` and mirrors the checks described in
|
|
152
|
-
[`CONTRIBUTING.md`](CONTRIBUTING.md):
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
./scripts/run_tests.sh
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The script sequentially executes `pydocstyle`, `pytest` under `coverage`, the
|
|
159
|
-
coverage summary, and `vulture --min-confidence 80 src tests`. Avoid running
|
|
160
|
-
`pytest` directly or executing the script from other directories, as the
|
|
161
|
-
environment may be misconfigured and imports will fail. To pass additional
|
|
162
|
-
flags to `pytest`, append them after `--`, for example:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
./scripts/run_tests.sh -- -k coherence
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Locking policy
|
|
169
|
-
|
|
170
|
-
The engine centralises reusable process-wide locks in
|
|
171
|
-
`tnfr.locking`. Modules obtain named locks via `locking.get_lock()` and
|
|
172
|
-
use the returned `threading.Lock` in their own critical sections. This
|
|
173
|
-
avoids scattering `threading.Lock` instances across the codebase and
|
|
174
|
-
ensures that shared resources are synchronised consistently.
|
|
175
|
-
Module-level caches or global state should always use these named
|
|
176
|
-
locks; only short-lived objects may instantiate ad-hoc locks directly
|
|
177
|
-
when they are not shared.
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Callback error handling
|
|
182
|
-
|
|
183
|
-
Callback errors are stored in a ring buffer attached to the graph. The
|
|
184
|
-
buffer retains at most the last 100 errors by default, but the limit can be
|
|
185
|
-
adjusted at runtime via ``tnfr.callback_utils.callback_manager.set_callback_error_limit``
|
|
186
|
-
and inspected with ``tnfr.callback_utils.callback_manager.get_callback_error_limit``.
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## Helper utilities API
|
|
191
|
-
|
|
192
|
-
`tnfr.helpers` bundles a compact set of public helpers that stay stable across
|
|
193
|
-
releases. They provide ergonomic access to the most common preparation steps
|
|
194
|
-
when orchestrating TNFR experiments.
|
|
195
|
-
|
|
196
|
-
### Collections and numeric helpers
|
|
197
|
-
|
|
198
|
-
* ``ensure_collection(it, *, max_materialize=...)`` — materialize potentially
|
|
199
|
-
lazy iterables once, enforcing a configurable limit to keep simulations
|
|
200
|
-
bounded.
|
|
201
|
-
* ``clamp(x, a, b)`` and ``clamp01(x)`` — restrict scalars to safe ranges for
|
|
202
|
-
operator parameters.
|
|
203
|
-
* ``kahan_sum_nd(values, dims)`` — numerically stable accumulators used to
|
|
204
|
-
track coherence magnitudes across long trajectories (use ``dims=1`` for
|
|
205
|
-
scalars, ``dims=2`` for paired values, etc.).
|
|
206
|
-
* ``angle_diff(a, b)`` — compute minimal angular differences (radians) to
|
|
207
|
-
compare structural phases.
|
|
208
|
-
|
|
209
|
-
### Historial de operadores estructurales
|
|
210
|
-
|
|
211
|
-
* ``push_glyph(nd, glyph, window)`` — registra la aplicación de un operador en el
|
|
212
|
-
historial del nodo respetando la ventana configurada.
|
|
213
|
-
* ``recent_glyph(nd, glyph, window)`` — comprueba si un operador específico
|
|
214
|
-
aparece en el historial reciente de un nodo.
|
|
215
|
-
* ``ensure_history(G)`` — prepare the graph-level history container with the
|
|
216
|
-
appropriate bounds.
|
|
217
|
-
* ``last_glyph(nd)`` — inspecciona el último operador emitido por un nodo.
|
|
218
|
-
* ``count_glyphs(G, window=None, *, last_only=False)`` — agrega el uso de
|
|
219
|
-
operadores estructurales en la red ya sea desde todo el historial o una
|
|
220
|
-
ventana limitada.
|
|
221
|
-
|
|
222
|
-
### Graph caches and ΔNFR invalidation
|
|
223
|
-
|
|
224
|
-
* ``cached_node_list(G)`` — lazily cache a stable tuple of node identifiers,
|
|
225
|
-
respecting opt-in sorted ordering.
|
|
226
|
-
* ``ensure_node_index_map(G)`` / ``ensure_node_offset_map(G)`` — expose cached
|
|
227
|
-
index and offset mappings for graphs that need to project nodes to arrays.
|
|
228
|
-
* ``node_set_checksum(G, nodes=None, *, presorted=False, store=True)`` —
|
|
229
|
-
produce deterministic BLAKE2b hashes to detect topology changes.
|
|
230
|
-
* ``stable_json(obj)`` — render deterministic JSON strings suited for hashing
|
|
231
|
-
and reproducible logs.
|
|
232
|
-
* ``get_graph(obj)`` / ``get_graph_mapping(G, key, warn_msg)`` — normalise
|
|
233
|
-
access to graph-level metadata regardless of wrappers.
|
|
234
|
-
* ``EdgeCacheManager`` together with ``edge_version_cache``,
|
|
235
|
-
``cached_nodes_and_A`` and ``edge_version_update`` encapsulate the edge
|
|
236
|
-
version cache. ``increment_edge_version`` bumps the version manually for
|
|
237
|
-
imperative workflows.
|
|
238
|
-
* ``mark_dnfr_prep_dirty(G)`` — invalidate precomputed ΔNFR preparation when
|
|
239
|
-
mutating edges outside the cache helpers.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Why TNFR (in 60 seconds)
|
|
244
|
-
|
|
245
|
-
* **From objects to coherences:** you model **processes** that hold, not fixed entities.
|
|
246
|
-
* **Operators instead of rules:** you compose **structural operators** (e.g., *emission*, *coherence*, *dissonance*) to **build trajectories**.
|
|
247
|
-
* **Operational fractality:** the same pattern works for **ideas, teams, tissues, narratives**; the scales change, **the logic doesn’t**.
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
## Key concepts (operational summary)
|
|
252
|
-
|
|
253
|
-
* **Node (NFR):** a unit that persists because it **resonates**. Parameterized by **νf** (frequency), **θ** (phase), and **EPI** (coherent form).
|
|
254
|
-
* **Structural operators** - functions that reorganize the network:
|
|
255
|
-
|
|
256
|
-
* **Emission** (start), **Reception** (open), **Coherence** (stabilize), **Dissonance** (creative tension), **Coupling** (synchrony), **Resonance** (propagate), **Silence** (latency), **Expansion**, **Contraction**, **Self‑organization**, **Mutation**, **Transition**, **Recursivity**.
|
|
257
|
-
* **Magnitudes:**
|
|
258
|
-
|
|
259
|
-
* **C(t):** global coherence.
|
|
260
|
-
* **ΔNFR:** nodal gradient (need for reorganization).
|
|
261
|
-
* **νf:** structural frequency (Hz\_str).
|
|
262
|
-
* **Si:** sense index (ability to generate stable shared coherence).
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
|
|
266
|
-
## Typical workflow
|
|
267
|
-
|
|
268
|
-
1. **Model** your system as a network: nodes (agents, ideas, tissues, modules) and couplings.
|
|
269
|
-
2. **Select** a **trajectory of operators** aligned with your goal (e.g., *start → couple → stabilize*).
|
|
270
|
-
3. **Simulate** the dynamics: number of steps, step size, tolerances.
|
|
271
|
-
4. **Measure**: C(t), ΔNFR, Si; identify bifurcations and collapses.
|
|
272
|
-
5. **Iterate** with controlled **dissonance** to open mutations without losing form.
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## Main metrics
|
|
277
|
-
|
|
278
|
-
* `coherence(traj) → C(t)`: global stability; higher values indicate sustained form.
|
|
279
|
-
* `gradient(state) → ΔNFR`: local demand for reorganization (high = risk of collapse/bifurcation).
|
|
280
|
-
* `sense_index(traj) → Si`: proxy for **structural sense** (capacity to generate shared coherence) combining **νf**, phase, and topology.
|
|
281
|
-
|
|
282
|
-
## Topological remeshing
|
|
283
|
-
|
|
284
|
-
Use ``tnfr.operators.apply_topological_remesh`` (``from tnfr.operators import apply_topological_remesh``)
|
|
285
|
-
to reorganize connectivity based on nodal EPI similarity while preserving
|
|
286
|
-
graph connectivity. Modes:
|
|
287
|
-
|
|
288
|
-
- ``"knn"`` – connect each node to its ``k`` nearest neighbours (with optional
|
|
289
|
-
rewiring).
|
|
290
|
-
- ``"mst"`` – retain only a minimum spanning tree.
|
|
291
|
-
- ``"community"`` – collapse modular communities and reconnect them by
|
|
292
|
-
similarity.
|
|
293
|
-
|
|
294
|
-
All modes ensure connectivity by adding a base MST.
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
## History configuration
|
|
299
|
-
|
|
300
|
-
Recorded series are stored under `G.graph['history']`. Set `HISTORY_MAXLEN` in
|
|
301
|
-
the graph (or override the default) to keep only the most recent entries. The
|
|
302
|
-
value must be non‑negative; negative values raise ``ValueError``. When the
|
|
303
|
-
limit is positive the library uses bounded `deque` objects and removes the
|
|
304
|
-
least populated series when the number of history keys grows beyond the limit.
|
|
305
|
-
|
|
306
|
-
### Random node sampling
|
|
307
|
-
|
|
308
|
-
To reduce costly comparisons the engine stores a per‑step random subset of
|
|
309
|
-
node ids under `G.graph['_node_sample']`. Operators may use this to avoid
|
|
310
|
-
scanning the whole network. Sampling is skipped automatically when the graph
|
|
311
|
-
has fewer than **50 nodes**, in which case all nodes are included.
|
|
312
|
-
|
|
313
|
-
### Jitter RNG cache
|
|
314
|
-
|
|
315
|
-
`random_jitter` uses an LRU cache of `random.Random` instances keyed by `(seed, node)`.
|
|
316
|
-
`JITTER_CACHE_SIZE` controls the maximum number of cached generators (default: `256`);
|
|
317
|
-
when the limit is exceeded the least‑recently used entry is discarded. Increase it for
|
|
318
|
-
large graphs or heavy jitter usage, or lower it to save memory.
|
|
319
|
-
|
|
320
|
-
To adjust the number of cached jitter sequences used for deterministic noise,
|
|
321
|
-
obtain the manager with ``get_jitter_manager`` before calling ``setup``:
|
|
322
|
-
|
|
323
|
-
```python
|
|
324
|
-
from tnfr.operators import get_jitter_manager
|
|
325
|
-
|
|
326
|
-
manager = get_jitter_manager()
|
|
327
|
-
# Resize cache to keep only 512 entries
|
|
328
|
-
manager.max_entries = 512
|
|
329
|
-
|
|
330
|
-
# or in a single call that also clears previous counters
|
|
331
|
-
manager.setup(max_entries=512)
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
``setup`` preserves the current size unless a new ``max_entries`` value is
|
|
335
|
-
supplied. Custom sizes persist across subsequent ``setup`` calls, and
|
|
336
|
-
``max_entries`` assignments take effect immediately.
|
|
337
|
-
|
|
338
|
-
### Edge version tracking
|
|
339
|
-
|
|
340
|
-
Wrap sequences of edge mutations with `edge_version_update(G)` so the edge
|
|
341
|
-
version increments on entry and exit. This keeps caches and structural logs
|
|
342
|
-
aligned with the network's evolution.
|
|
343
|
-
|
|
344
|
-
### Defaults injection performance
|
|
345
|
-
|
|
346
|
-
`inject_defaults` evita copias profundas cuando los valores son inmutables (números,
|
|
347
|
-
cadenas, tuplas). Solo se usa `copy.deepcopy` para estructuras mutables, reduciendo
|
|
348
|
-
el costo de inicializar grafos con parámetros por defecto.
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
## Trained GPT
|
|
353
|
-
|
|
354
|
-
https://chatgpt.com/g/g-67abc78885a88191b2d67f94fd60dc97-tnfr-teoria-de-la-naturaleza-fractal-resonante
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## Changelog
|
|
359
|
-
|
|
360
|
-
* Removed deprecated alias `sigma_vector_global`; use `sigma_vector_from_graph` instead.
|
|
361
|
-
* Removed legacy `tnfr.program` alias; import programming helpers from `tnfr.execution`.
|
|
362
|
-
* Stopped re-exporting ``CallbackSpec`` and ``apply_topological_remesh`` at the
|
|
363
|
-
package root; import them via ``tnfr.trace`` and ``tnfr.operators``.
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## MIT License
|
|
368
|
-
|
|
369
|
-
Copyright (c) 2025 TNFR - Teoría de la naturaleza fractral resonante
|
|
370
|
-
|
|
371
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
372
|
-
|
|
373
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
374
|
-
|
|
375
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
If you use `tnfr` in research or projects, please cite the TNFR conceptual framework and link to the PyPI package.
|
tnfr-4.5.2.dist-info/RECORD
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
tnfr/__init__.py,sha256=hPgnqhJxoa5C1rpRghF51ux8aV6SEUCp4CEXB63tNFY,2921
|
|
2
|
-
tnfr/alias.py,sha256=CvfXiTNyQCLI6RwkAriCnE8ajbadsJKA7gFeSz-sFCM,15568
|
|
3
|
-
tnfr/cache.py,sha256=l15jZyJoPbs6rUZfnq3UKwHaRnAmsPPZBBYcJ5iS2VY,16841
|
|
4
|
-
tnfr/callback_utils.py,sha256=O0zgH-fl813A-wmWtp9dG4SK0Phq4YK_ZaHV6fC1rDU,12257
|
|
5
|
-
tnfr/collections_utils.py,sha256=f1zbti135Yu9b5ou7SKl6w3x0T-Ew9FyuKMCmAd9zRo,9774
|
|
6
|
-
tnfr/config.py,sha256=vx7l92bBFHEeE7faDrNucaLYmk4jnX4R41RErJk3Z5k,1032
|
|
7
|
-
tnfr/constants_glyphs.py,sha256=j4hatCJrqxoLfNki4cIV_VWkRVVjR0uP9ZEoiL7bZKU,2566
|
|
8
|
-
tnfr/execution.py,sha256=Sjf-2LDIzWvVP3Ri3edSvpcEwC4OsyPqh2WrCY6PfxU,5068
|
|
9
|
-
tnfr/flatten.py,sha256=iNzHei_otD07_EMR4AsWyPU2lwAldgDQioUyITvyUpo,8178
|
|
10
|
-
tnfr/gamma.py,sha256=TfFze8X3cUQn0pIG6opudkFLNlt1rj95upS9H8YiVI8,10658
|
|
11
|
-
tnfr/glyph_history.py,sha256=F_v0X17BUOJlJn9u2rU5gK5Rr3t_fjemVDJrm45NEn8,9158
|
|
12
|
-
tnfr/grammar.py,sha256=_sJcTLeBAOmTKGnir7SiVQIHrgNXu44afhVGFwId4h8,10527
|
|
13
|
-
tnfr/graph_utils.py,sha256=crRQ-b7MpIRXP_xAHkLYIVU42RrgRqgJTPzZkNPMAI4,2265
|
|
14
|
-
tnfr/immutable.py,sha256=Tmut7BWcnILdehmFpt0WA5EWpnF7tp-5f30Rfnaz-rQ,4951
|
|
15
|
-
tnfr/import_utils.py,sha256=0yqPuqyCmMsAHvqRovIpaTCQ-1YolljrXnfG2CUTm1E,6538
|
|
16
|
-
tnfr/initialization.py,sha256=AelCnte63X0GOQTWsfzMK66rOO4PfxRCa9gUlIigEvU,5783
|
|
17
|
-
tnfr/io.py,sha256=ITA3CVCCzU1BY-eltUi299iDKcJgMKFJ6-4tR2zg_is,6608
|
|
18
|
-
tnfr/json_utils.py,sha256=_T4DeZZ0omqtigySG3Xc1e0C1ymRtqIWnW_DrYCgf9E,5277
|
|
19
|
-
tnfr/locking.py,sha256=mOvaENBNSsWw6KiBG_UXv4xXfZ9uQZvWw5SN2cKFmSU,1168
|
|
20
|
-
tnfr/logging_utils.py,sha256=9gEnMYUfxP-824tD1jHI2_98Cfzvlxu-xLCJ996bDW8,3574
|
|
21
|
-
tnfr/node.py,sha256=RVYW4A3_I2oNs36EF_HMas0AqrxmaQc6rzoR1wrhQQ0,7121
|
|
22
|
-
tnfr/observers.py,sha256=okpR67Vc0lujiFotutgMeQsFodh9PdhfilaIPKw49QE,4623
|
|
23
|
-
tnfr/ontosim.py,sha256=UWx8NhovmITosS2vxTPLERaaoGXm0isGSyOjrUwRYXg,4043
|
|
24
|
-
tnfr/presets.py,sha256=RR0EuKSI5_TTfsB2ng2pFeFMVxgGwHDDbdy_sCO3gM0,1341
|
|
25
|
-
tnfr/rng.py,sha256=UDW1dyDAzJPqIrNDF-ehTgNEy3xRL5OnAgDMnoXJX7k,7310
|
|
26
|
-
tnfr/selector.py,sha256=tIA_XcLtXt53Tdz6o9ZGIvI1qdAbp3VT3tYsMXhVLsA,5884
|
|
27
|
-
tnfr/sense.py,sha256=d1vmRHnpMupuSawerREpv5LrFrBa1JiANra0DiYJ4Js,9845
|
|
28
|
-
tnfr/structural.py,sha256=TXGA9qp8hHIdrYFo6CBUh7lGUcap8Fkk06_dmrvzpg4,8749
|
|
29
|
-
tnfr/tokens.py,sha256=nhfBtef-S6XdvGXz6uoJTSzDr45Wr6km1bBNUHek12g,1124
|
|
30
|
-
tnfr/trace.py,sha256=sdzD3g6pUlaAPDsPLjBVzOlsV_sJMALZR0hN008PcYc,10283
|
|
31
|
-
tnfr/types.py,sha256=n6Gr4BwUr8eWVFcSrjM6uH2iGbNvNN2onYDGAA4yZiU,982
|
|
32
|
-
tnfr/validators.py,sha256=xSQk_H9JLaiDPtVAQ0zQaP-EWhhXbAQZOR9Y3F80y1U,2671
|
|
33
|
-
tnfr/value_utils.py,sha256=tmgmHXRLr77Y-fyHX5GUwy8kYVxRYvKas53ynUWW-y0,1613
|
|
34
|
-
tnfr/cli/__init__.py,sha256=dF5YkpTml_txA6GaH0IP_9NMuZYdEGjAH2wrVarx8OU,1775
|
|
35
|
-
tnfr/cli/arguments.py,sha256=ZgNIWEaY0DZ1-04km0twiSmR5iDAhod6fKdJ-Tt0C60,5698
|
|
36
|
-
tnfr/cli/execution.py,sha256=-gMAXI-5QDifM9y5qkUjot33A0sHHzxAy7hkhU-2Rrc,8910
|
|
37
|
-
tnfr/cli/utils.py,sha256=KNnE1z3pYKsxm3-naDMfLkYOd1gmtuoqA19Z27K1qZ8,979
|
|
38
|
-
tnfr/constants/__init__.py,sha256=DFbpF9uEvVqJn4ljYLvV-rdLTf2viGuF49Gb7k9MVrA,5011
|
|
39
|
-
tnfr/constants/core.py,sha256=ulMaJajWf6VPVbpxi64QQ2m5_w3Vd_WDfJYJ2C2xlv8,4720
|
|
40
|
-
tnfr/constants/init.py,sha256=WdMKkdPKO7vyQoJAuoFnhWbb3n1nBkmkzprwyYj_ZN8,805
|
|
41
|
-
tnfr/constants/metric.py,sha256=xicROOCW8gd3C3IM-fYZ18UhEtrcmkV2VQ-v3Bwms7M,3503
|
|
42
|
-
tnfr/dynamics/__init__.py,sha256=lldlB5YZZzFJlcGHKi8QuxSOfCWqU8lIuYwHdOltUXw,20964
|
|
43
|
-
tnfr/dynamics/dnfr.py,sha256=bQ_FNfJBZ7lfFBdV4I9tTueTr846qLL38b4ffMPIlLI,22114
|
|
44
|
-
tnfr/dynamics/integrators.py,sha256=RK4rG9A5PrvRoUfIjRbeAtU1Yk4T6hEKB24-Rw-eFhg,8204
|
|
45
|
-
tnfr/dynamics/sampling.py,sha256=6dkmv4ul_eFGlXAX4pqkH7-PVofHUrQM3_RH36T1AMQ,1148
|
|
46
|
-
tnfr/helpers/__init__.py,sha256=9pCBXPg-Iid4uttV9fuTaqNgcHIRnwsymKJ86vzNB_Y,1638
|
|
47
|
-
tnfr/helpers/numeric.py,sha256=IdvF1RZzdBx1S_kGGDrBxTmrARfR0E03Vz62FhT5Xxw,2692
|
|
48
|
-
tnfr/metrics/__init__.py,sha256=4gujlyn3aN95lkxCjQPPgKS_xJYm5ShcraeEkDYKR_E,885
|
|
49
|
-
tnfr/metrics/coherence.py,sha256=DTf6oP1NWfX2ILvvC6I73kFDPXhypknLCZK9UcKoxXA,23273
|
|
50
|
-
tnfr/metrics/common.py,sha256=mZCwtH_hkd2VbaF93TISFfeCLHNb-C9ajziZAAaLGzQ,4418
|
|
51
|
-
tnfr/metrics/core.py,sha256=pHXO4R64vm1dsnvub3ymN0vvKEekgqAUn50kc6hsnHE,2641
|
|
52
|
-
tnfr/metrics/diagnosis.py,sha256=np9AF_fbbxqxUsVS6TFfArIdeRTDBDq6KHAHBy2Ak6M,6603
|
|
53
|
-
tnfr/metrics/export.py,sha256=bPSvXfAF9jTOomy61CZFlwqZVwqbea-L7nm7yGxuR4s,4214
|
|
54
|
-
tnfr/metrics/glyph_timing.py,sha256=ROBEHp2GhQ6Cxawcw-7BskWZNLQdU0kcX_hW6RdGjKQ,5082
|
|
55
|
-
tnfr/metrics/reporting.py,sha256=ajuKS0bL5T33VRsr31ZR0xHJvd5pWXurVDgH9EvBF3M,3806
|
|
56
|
-
tnfr/metrics/sense_index.py,sha256=BLc99BjrcdztKr3Ftou88Y4orADBW4bEBUyCvQTs4mY,3299
|
|
57
|
-
tnfr/metrics/trig.py,sha256=qdjqwjyJTuv0O5wlmkfugfi6twPvKASohaRQA2kmy5M,5306
|
|
58
|
-
tnfr/metrics/trig_cache.py,sha256=WtgIqH8IkwzXuYk8SR06zRyPnZlCvyCnyRjmEzRqneY,3101
|
|
59
|
-
tnfr/operators/__init__.py,sha256=MhOTKM50P4WrC5RjSH5qyBSHF6W4nxtddmiGR7Z0jnQ,12296
|
|
60
|
-
tnfr/operators/jitter.py,sha256=CNZje2645qw64xxfLS9pWoOVEvabOdZAe9M8j0f9rpM,5930
|
|
61
|
-
tnfr/operators/remesh.py,sha256=u1VhdN7-n3hlJGcDtMk4VG3CmrH8A7iVQOlsEXedZDY,15100
|
|
62
|
-
tnfr-4.5.2.dist-info/licenses/LICENSE.md,sha256=SRvvhXLrKtseuK6DARbuJffuXOXqAyk3wvF2n0t1SWA,1109
|
|
63
|
-
tnfr-4.5.2.dist-info/METADATA,sha256=ITBMg5NNN1zOVcTCV_NkvkccXt6jJt4FHoXhdEaQBKQ,17367
|
|
64
|
-
tnfr-4.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
65
|
-
tnfr-4.5.2.dist-info/entry_points.txt,sha256=j4-QRHqeT2WnchHe_mvK7npGTLjlyfLpvRONFe9Z4MU,39
|
|
66
|
-
tnfr-4.5.2.dist-info/top_level.txt,sha256=Q2HJnvc5Rt2VHwVvyBTnNPT4SfmJWnCj7XUxxEvQa7c,5
|
|
67
|
-
tnfr-4.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|