tnfr 4.5.0__py3-none-any.whl → 4.5.2__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 +91 -89
- tnfr/alias.py +546 -0
- tnfr/cache.py +578 -0
- tnfr/callback_utils.py +388 -0
- tnfr/cli/__init__.py +75 -0
- tnfr/cli/arguments.py +177 -0
- tnfr/cli/execution.py +288 -0
- tnfr/cli/utils.py +36 -0
- tnfr/collections_utils.py +300 -0
- tnfr/config.py +19 -28
- tnfr/constants/__init__.py +174 -0
- tnfr/constants/core.py +159 -0
- tnfr/constants/init.py +31 -0
- tnfr/constants/metric.py +110 -0
- tnfr/constants_glyphs.py +98 -0
- tnfr/dynamics/__init__.py +658 -0
- tnfr/dynamics/dnfr.py +733 -0
- tnfr/dynamics/integrators.py +267 -0
- tnfr/dynamics/sampling.py +31 -0
- tnfr/execution.py +201 -0
- tnfr/flatten.py +283 -0
- tnfr/gamma.py +302 -88
- tnfr/glyph_history.py +290 -0
- tnfr/grammar.py +285 -96
- tnfr/graph_utils.py +84 -0
- tnfr/helpers/__init__.py +71 -0
- tnfr/helpers/numeric.py +87 -0
- tnfr/immutable.py +178 -0
- tnfr/import_utils.py +228 -0
- tnfr/initialization.py +197 -0
- tnfr/io.py +246 -0
- tnfr/json_utils.py +162 -0
- tnfr/locking.py +37 -0
- tnfr/logging_utils.py +116 -0
- tnfr/metrics/__init__.py +41 -0
- tnfr/metrics/coherence.py +829 -0
- tnfr/metrics/common.py +151 -0
- tnfr/metrics/core.py +101 -0
- tnfr/metrics/diagnosis.py +234 -0
- tnfr/metrics/export.py +137 -0
- tnfr/metrics/glyph_timing.py +189 -0
- tnfr/metrics/reporting.py +148 -0
- tnfr/metrics/sense_index.py +120 -0
- tnfr/metrics/trig.py +181 -0
- tnfr/metrics/trig_cache.py +109 -0
- tnfr/node.py +214 -159
- tnfr/observers.py +126 -128
- tnfr/ontosim.py +134 -134
- tnfr/operators/__init__.py +420 -0
- tnfr/operators/jitter.py +203 -0
- tnfr/operators/remesh.py +485 -0
- tnfr/presets.py +46 -14
- tnfr/rng.py +254 -0
- tnfr/selector.py +210 -0
- tnfr/sense.py +284 -131
- tnfr/structural.py +207 -79
- tnfr/tokens.py +60 -0
- tnfr/trace.py +329 -94
- tnfr/types.py +43 -17
- tnfr/validators.py +70 -24
- tnfr/value_utils.py +59 -0
- tnfr-4.5.2.dist-info/METADATA +379 -0
- tnfr-4.5.2.dist-info/RECORD +67 -0
- tnfr/cli.py +0 -322
- tnfr/constants.py +0 -277
- tnfr/dynamics.py +0 -814
- tnfr/helpers.py +0 -264
- tnfr/main.py +0 -47
- tnfr/metrics.py +0 -597
- tnfr/operators.py +0 -525
- tnfr/program.py +0 -176
- tnfr/scenarios.py +0 -34
- tnfr-4.5.0.dist-info/METADATA +0 -109
- tnfr-4.5.0.dist-info/RECORD +0 -28
- {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/WHEEL +0 -0
- {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/entry_points.txt +0 -0
- {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/licenses/LICENSE.md +0 -0
- {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/top_level.txt +0 -0
tnfr/scenarios.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from typing import Any
|
|
3
|
-
import random
|
|
4
|
-
import networkx as nx
|
|
5
|
-
|
|
6
|
-
from .constants import inject_defaults, DEFAULTS
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def build_graph(n: int = 24, topology: str = "ring", seed: int | None = 1):
|
|
10
|
-
rng = random.Random(seed)
|
|
11
|
-
if topology == "ring":
|
|
12
|
-
G = nx.cycle_graph(n)
|
|
13
|
-
elif topology == "complete":
|
|
14
|
-
G = nx.complete_graph(n)
|
|
15
|
-
elif topology == "erdos":
|
|
16
|
-
G = nx.gnp_random_graph(n, 3.0 / n, seed=seed)
|
|
17
|
-
else:
|
|
18
|
-
G = nx.path_graph(n)
|
|
19
|
-
|
|
20
|
-
# Valores canónicos para inicialización
|
|
21
|
-
inject_defaults(G, DEFAULTS)
|
|
22
|
-
vf_min = float(G.graph.get("VF_MIN", DEFAULTS["VF_MIN"]))
|
|
23
|
-
vf_max = float(G.graph.get("VF_MAX", DEFAULTS["VF_MAX"]))
|
|
24
|
-
th_min = float(G.graph.get("INIT_THETA_MIN", DEFAULTS.get("INIT_THETA_MIN", -3.1416)))
|
|
25
|
-
th_max = float(G.graph.get("INIT_THETA_MAX", DEFAULTS.get("INIT_THETA_MAX", 3.1416)))
|
|
26
|
-
|
|
27
|
-
for i in G.nodes():
|
|
28
|
-
nd = G.nodes[i]
|
|
29
|
-
nd.setdefault("EPI", rng.uniform(0.1, 0.3))
|
|
30
|
-
nd.setdefault("νf", rng.uniform(vf_min, vf_max))
|
|
31
|
-
nd.setdefault("θ", rng.uniform(th_min, th_max))
|
|
32
|
-
nd.setdefault("Si", rng.uniform(0.4, 0.7))
|
|
33
|
-
|
|
34
|
-
return G
|
tnfr-4.5.0.dist-info/METADATA
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tnfr
|
|
3
|
-
Version: 4.5.0
|
|
4
|
-
Summary: Canonical TNFR: modular glyph-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
|
-
Keywords: TNFR,resonant fractal,resonance,glyphs,networkx,dynamics,coherence,EPI,Kuramoto
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
-
Classifier: Operating System :: OS Independent
|
|
19
|
-
Classifier: Intended Audience :: Science/Research
|
|
20
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
-
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
|
-
Requires-Python: >=3.9
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE.md
|
|
25
|
-
Requires-Dist: networkx>=2.6
|
|
26
|
-
Dynamic: license-file
|
|
27
|
-
|
|
28
|
-
# TNFR Python Project
|
|
29
|
-
|
|
30
|
-
Reference implementation of the Resonant Fractal Nature Theory (TNFR).
|
|
31
|
-
It models glyph-driven dynamics on NetworkX graphs, providing a modular
|
|
32
|
-
engine to simulate coherent reorganization processes.
|
|
33
|
-
|
|
34
|
-
## General Project Structure
|
|
35
|
-
|
|
36
|
-
* **Package entry point.** `__init__.py` registers modules under short names to avoid circular imports and exposes the public API: `preparar_red`, `step`, `run`, and observation utilities.
|
|
37
|
-
|
|
38
|
-
* **Configuration & constants.** `constants.py` centralizes default parameters (discretization, EPI and νf ranges, mixing weights, re-mesh limits, etc.) and provides utilities to inject them into the network (`attach_defaults`, `merge_overrides`), along with standardized aliases for node attributes.
|
|
39
|
-
|
|
40
|
-
* **Cross-cutting utilities.** `helpers.py` offers core numeric helpers, alias-based attribute accessors, neighborhood statistics, glyph history, a callback system, and computation of the sense index `Si` for each node.
|
|
41
|
-
|
|
42
|
-
* **Dynamics engine.** `dynamics.py` implements the simulation loop: ΔNFR field computation, nodal equation integration, glyph selection/application, clamps, phase coordination, history updates, and conditional re-mesh (`step` and `run`).
|
|
43
|
-
|
|
44
|
-
* **Glyph operators.** `operators.py` defines the 13 glyphs as local transformations, a dispatcher `aplicar_glifo`, and both direct and stability-conditioned re-mesh utilities.
|
|
45
|
-
|
|
46
|
-
* **Observers & metrics.** `observers.py` registers standard callbacks and computes global coherence, phase synchrony, Kuramoto order, glyph distribution, and the sense vector `Σ⃗`, among others.
|
|
47
|
-
|
|
48
|
-
* **Simulation orchestration.** `ontosim.py` prepares a NetworkX graph, attaches configuration, and initializes attributes (EPI, phases, frequencies) before delegating dynamics to `dynamics.step`/`run`.
|
|
49
|
-
|
|
50
|
-
* **Demo CLI.** `main.py` generates an Erdős–Rényi network, lets you tweak basic parameters, and runs the simulation while displaying final metrics.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Key Concepts to Grasp
|
|
55
|
-
|
|
56
|
-
* **Aliased dependency tree.** Modules import each other via global aliases to simplify access and prevent cycles—essential for navigating the code unambiguously.
|
|
57
|
-
|
|
58
|
-
* **Normalized node attributes.** All data (EPI, phase `θ`, frequency `νf`, `ΔNFR`, etc.) live in `G.nodes[n]` under compatible alias names, making extensions and custom hooks straightforward.
|
|
59
|
-
|
|
60
|
-
* **Sense Index (`Si`).** Combines normalized frequency, phase dispersion, and field magnitude to evaluate each node’s “sense,” influencing glyph selection.
|
|
61
|
-
|
|
62
|
-
* **Step-wise engine.** `dynamics.step` orchestrates eight phases: field computation, `Si`, glyph selection & application, integration, clamps, phase coordination, history update, and conditioned re-mesh.
|
|
63
|
-
|
|
64
|
-
* **Glyphs as operators.** Each glyph applies a smooth transformation to node attributes (emission, diffusion, coupling, dissonance, etc.), dispatched by a configurable, typographic name.
|
|
65
|
-
|
|
66
|
-
* **Network re-mesh.** Mixes the current state with a past one (memory `τ`) to stabilize the network, with clear precedence for `α` and conditions based on recent stability and synchrony history.
|
|
67
|
-
|
|
68
|
-
* **Γ(R) coupling.** Optional network term added to the nodal equation, parameterized by global phase order `R` with gain `β` and threshold `R0` (see `DEFAULTS["GAMMA"]`).
|
|
69
|
-
|
|
70
|
-
* **Callbacks & observers.** The `Γ(R)` system lets you hook functions before/after each step and after re-mesh, enabling monitoring or external intervention.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Recommendations for Going Deeper
|
|
75
|
-
|
|
76
|
-
* **NetworkX & the Graph API.** Get comfortable with how NetworkX handles attributes and topology; all dynamics operate on `Graph` objects and their properties.
|
|
77
|
-
|
|
78
|
-
* **Extending the ΔNFR field.** Explore `set_delta_nfr_hook` to implement alternative nodal fields and learn how metadata and mixing weights are recorded.
|
|
79
|
-
|
|
80
|
-
* **Designing new glyphs.** Review `operators.py` to add operators or adjust factors in `DEFAULTS['GLYPH_FACTORS']`.
|
|
81
|
-
|
|
82
|
-
* **Custom observers.** Implement your own metrics via `register_callback` or by extending `observers.py` to measure phenomena specific to your study.
|
|
83
|
-
|
|
84
|
-
* **Theoretical reading.** For conceptual background, see the included PDFs (`TNFR.pdf`, *El Pulso que nos Atraviesa*), which deepen the fractal-resonant framework.
|
|
85
|
-
|
|
86
|
-
* **Advanced parameters.** Experiment with adaptive phase coordination, stability criteria, and the glyph grammar to observe their impact on network self-organization.
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
**Mastering these pieces will let you extend the simulation, build analysis pipelines and connect the theory with computational applications.**
|
|
91
|
-
|
|
92
|
-
## Optional Node environment
|
|
93
|
-
The repository includes a minimal `package.json` and `netlify.toml` used for an experimental Remix web demo. They are not required for the core Python package; feel free to ignore them unless you plan to build the demo via `npm run build`.
|
|
94
|
-
|
|
95
|
-
## Testing
|
|
96
|
-
|
|
97
|
-
Install the dependencies and project in editable mode before running the test suite with `pytest`:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
pip install networkx
|
|
101
|
-
pip install -e .
|
|
102
|
-
pytest
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Installation
|
|
107
|
-
```
|
|
108
|
-
pip install tnfr
|
|
109
|
-
```
|
tnfr-4.5.0.dist-info/RECORD
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
tnfr/__init__.py,sha256=c3fypVJdVZeV-AEZEPsr4NZZRwH9reGEBwoNnT9dP88,2788
|
|
2
|
-
tnfr/cli.py,sha256=7OR3dlWUVjEKVH_itH-zYq8WQculXwSdCDDvmQH15kY,14372
|
|
3
|
-
tnfr/config.py,sha256=bFc5AnLVoF0oUrSedAi5WpD6oCvn4hhLHO7WGgslg2M,1303
|
|
4
|
-
tnfr/constants.py,sha256=XoUlTuUaQgQ6BbHzKSIHijqRMf9Gb3Avjo7_CLicgps,11570
|
|
5
|
-
tnfr/dynamics.py,sha256=An0MlAJVhCy5uCQsl3c_PZKdAKBZojgRCnTAQzfaahg,32799
|
|
6
|
-
tnfr/gamma.py,sha256=U1yXbv4ef9VSwXirjRlcwdNr78Ah5LstAsg5WIkRQxY,4083
|
|
7
|
-
tnfr/grammar.py,sha256=vz5F0P3IfvA6HassRcoD327hBP5vCUw-xPSTsPmqwhQ,5363
|
|
8
|
-
tnfr/helpers.py,sha256=KT9_CAz3Z-WRKdARyGnsQ16m-p2z-l1-Y6UhVyY8tcU,8323
|
|
9
|
-
tnfr/main.py,sha256=XqjI1YEdF-OqRzTMa5dYIxCig4qyAR-l1FPcyxpC8WY,1926
|
|
10
|
-
tnfr/metrics.py,sha256=MTp0YifWdycW-jUFWhvxbJx-labWUR0thTnS0sxifrg,20259
|
|
11
|
-
tnfr/node.py,sha256=A3nlaW_lwG0Q1dj6HPmyjfccWfZt4rwnzqPxTglu-Sk,6184
|
|
12
|
-
tnfr/observers.py,sha256=PTw3hxk7KD-Yx_CvCIU09icuhyYD6uNU6SvF80UvP-Y,5354
|
|
13
|
-
tnfr/ontosim.py,sha256=9GfEtiLIdJOPJUTufcq_MssAA9J8AfChHU6HKb3DIJY,5628
|
|
14
|
-
tnfr/operators.py,sha256=TSY2LNIC-um3iSwniYiyu6oumnDwiES2zwb2B7ZbEZE,20536
|
|
15
|
-
tnfr/presets.py,sha256=qFuDxlexc_kw--3VRaOx3cfyL6vPEOX_UVsJd2DNWAE,998
|
|
16
|
-
tnfr/program.py,sha256=eim7D8zsbbkGDWbODag-0VKG44jEYioX4Sl6KRwgVtw,6038
|
|
17
|
-
tnfr/scenarios.py,sha256=QkUdCHp5R5T44fgfGppJ8dHzZa6avdNTNsYJbya_7XM,1165
|
|
18
|
-
tnfr/sense.py,sha256=9ABkqHjwu5pxoakddZwANpp9xy_NNo4frm9NGTg1GXQ,6482
|
|
19
|
-
tnfr/structural.py,sha256=hE5_l7cuiPad9AuFVrFtnkJ8A8eL_e69gUN5VknkQiI,5155
|
|
20
|
-
tnfr/trace.py,sha256=e_xdOOMZ5rqXOcdw99h8X1RnVuf_s9AeTzncqS551hE,4735
|
|
21
|
-
tnfr/types.py,sha256=CnSwzzh9d0WgqB128y71iNWiiAA7Sf-eJ_v1xHMAwLo,507
|
|
22
|
-
tnfr/validators.py,sha256=tCsz9A8OvEKiBZX9wvvri_C894XXdWfkbEZ6qqpcdNg,1169
|
|
23
|
-
tnfr-4.5.0.dist-info/licenses/LICENSE.md,sha256=SRvvhXLrKtseuK6DARbuJffuXOXqAyk3wvF2n0t1SWA,1109
|
|
24
|
-
tnfr-4.5.0.dist-info/METADATA,sha256=k7dlvh_IujIeTJfUfQXvCV9h6RbbtQvIbsJ3ylKUHTo,6301
|
|
25
|
-
tnfr-4.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
-
tnfr-4.5.0.dist-info/entry_points.txt,sha256=j4-QRHqeT2WnchHe_mvK7npGTLjlyfLpvRONFe9Z4MU,39
|
|
27
|
-
tnfr-4.5.0.dist-info/top_level.txt,sha256=Q2HJnvc5Rt2VHwVvyBTnNPT4SfmJWnCj7XUxxEvQa7c,5
|
|
28
|
-
tnfr-4.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|