tnfr 4.5.0__py3-none-any.whl → 4.5.1__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 CHANGED
@@ -8,7 +8,7 @@ Ecuación nodal:
8
8
  ∂EPI/∂t = νf · ΔNFR(t)
9
9
  """
10
10
 
11
- __version__ = "4.5.0"
11
+ __version__ = "4.5.1"
12
12
 
13
13
  # Re-exports de la API pública
14
14
  from .dynamics import step, run, set_delta_nfr_hook, validate_canon
@@ -87,3 +87,4 @@ __all__ = [
87
87
  ]
88
88
 
89
89
 
90
+
tnfr/observers.py CHANGED
@@ -101,9 +101,17 @@ def carga_glifica(G, window: int | None = None) -> dict:
101
101
  # Proporciones por glifo
102
102
  dist = {k: v / count for k, v in total.items()}
103
103
 
104
-
105
104
  # Agregados conceptuales (puedes ajustar categorías)
105
+ # Glifos que consolidan la coherencia nodal: I’L estabiliza el flujo (cap. 6),
106
+ # R’A propaga la resonancia (cap. 9), U’M acopla nodos en fase (cap. 8)
107
+ # y SH’A ofrece silencio regenerativo (cap. 10). Véase manual TNFR,
108
+ # sec. 18.19 "Análisis morfosintáctico" para la taxonomía funcional.
106
109
  estabilizadores = ["I’L", "R’A", "U’M", "SH’A"]
110
+
111
+ # Glifos que perturban o reconfiguran la red: O’Z introduce disonancia
112
+ # evolutiva (cap. 7), Z’HIR muta la estructura (cap. 14), NA’V marca
113
+ # el tránsito entre estados (cap. 15) y T’HOL autoorganiza un nuevo
114
+ # orden (cap. 13). Véase manual TNFR, sec. 18.19 para esta clasificación.
107
115
  disruptivos = ["O’Z", "Z’HIR", "NA’V", "T’HOL"]
108
116
 
109
117
 
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: tnfr
3
+ Version: 4.5.1
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
+ 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 package
29
+
30
+ > 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).
31
+
32
+ ---
33
+
34
+ ## What is `tnfr`?
35
+
36
+ `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 Resonant Fractal Nature Theory (TNFR), which understands reality as **networks of coherence** that persist because they **resonate**.
37
+
38
+ In practical terms, `tnfr` lets you:
39
+
40
+ * Model **Resonant Fractal Nodes (NFR)** with parameters for **frequency** (νf), **phase** (θ), and **form** (EPI).
41
+ * Apply **structural operators** to start, stabilize, propagate, or reconfigure coherence.
42
+ * **Simulate** nodal dynamics with discrete/continuous integrators.
43
+ * **Measure** global coherence C(t), nodal gradient ΔNFR, and the **Sense Index** (Si).
44
+ * **Visualize** states and trajectories (coupling matrices, C(t) curves, graphs).
45
+
46
+ > **Nodal equation (operational core)**
47
+ >
48
+ > $\frac{\partial \mathrm{EPI}}{\partial t} = \nu_f\,\cdot\,\Delta\mathrm{NFR}(t)$
49
+ >
50
+ > A form emerges and persists when **internal reorganization** (ΔNFR) **resonates** with the node’s **frequency** (νf).
51
+
52
+ ---
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install tnfr
58
+ ```
59
+
60
+ Requires **Python ≥ 3.9**.
61
+
62
+ ---
63
+
64
+ ## Why TNFR (in 60 seconds)
65
+
66
+ * **From objects to coherences:** you model **processes** that hold, not fixed entities.
67
+ * **Operators instead of rules:** you compose **structural operators** (e.g., *emission*, *coherence*, *dissonance*) to **build trajectories**.
68
+ * **Operational fractality:** the same pattern works for **ideas, teams, tissues, narratives**; the scales change, **the logic doesn’t**.
69
+
70
+ ---
71
+
72
+ ## Getting started (minimal recipe)
73
+
74
+ > *The high‑level API centers on three things: nodes, operators, simulation.*
75
+
76
+ ```python
77
+ # 1) Nodes and network
78
+ import tnfr as T
79
+
80
+ # A minimal set of nodes with initial frequency (νf)
81
+ A = T.Node(label="seed", nu_f=0.8)
82
+ B = T.Node(label="context", nu_f=0.6)
83
+ net = T.Network([A, B], edges=[(A, B, 0.7)]) # coupling 0..1
84
+
85
+ # 2) Sequence of structural operators
86
+ ops = [
87
+ T.ops.Emission(strength=0.4), # start pattern
88
+ T.ops.Coupling(weight=0.7), # synchronize nodes
89
+ T.ops.Coherence(), # stabilize form
90
+ ]
91
+
92
+ # 3) Simulation and metrics
93
+ traj = T.sim.run(net, ops, steps=200, dt=0.05)
94
+ print("C(t) =", T.metrics.coherence(traj)[-1])
95
+ print("Si =", T.metrics.sense_index(traj))
96
+
97
+ # 4) Quick visualization
98
+ T.viz.plot_coherence(traj) # C(t) curve
99
+ T.viz.plot_network(net) # graph/couplings
100
+ ```
101
+
102
+ > **Note:** Specific class/function names may vary across minor versions. Check `help(T.ops)` and `help(T.sim)` for your installed API.
103
+
104
+ ---
105
+
106
+ ## Key concepts (operational summary)
107
+
108
+ * **Node (NFR):** a unit that persists because it **resonates**. Parameterized by **νf** (frequency), **θ** (phase), and **EPI** (coherent form).
109
+ * **Structural operators:** functions that reorganize the network. We use **functional** names (not phonemes):
110
+
111
+ * **Emission** (start), **Reception** (open), **Coherence** (stabilize), **Dissonance** (creative tension), **Coupling** (synchrony), **Resonance** (propagate), **Silence** (latency), **Expansion**, **Contraction**, **Self‑organization**, **Mutation**, **Transition**, **Recursivity**.
112
+ * **Magnitudes:**
113
+
114
+ * **C(t):** global coherence.
115
+ * **ΔNFR:** nodal gradient (need for reorganization).
116
+ * **νf:** structural frequency (Hz\_str).
117
+ * **Si:** sense index (ability to generate stable shared coherence).
118
+
119
+ ---
120
+
121
+ ## Typical workflow
122
+
123
+ 1. **Model** your system as a network: nodes (agents, ideas, tissues, modules) and couplings.
124
+ 2. **Select** a **trajectory of operators** aligned with your goal (e.g., *start → couple → stabilize*).
125
+ 3. **Simulate** the dynamics: number of steps, step size, tolerances.
126
+ 4. **Measure**: C(t), ΔNFR, Si; identify bifurcations and collapses.
127
+ 5. **Iterate** with controlled **dissonance** to open mutations without losing form.
128
+
129
+ ---
130
+
131
+ ## High‑level API (orientation map)
132
+
133
+ > The typical module layout in `tnfr` is:
134
+
135
+ * `tnfr.core`: `Node`, `Network`, `EPI`, `State`
136
+ * `tnfr.ops`: structural operators (Emission, Reception, Coherence, Dissonance, ...)
137
+ * `tnfr.sim`: integrators (`run`, `step`, `integrate`), dt control and thresholds
138
+ * `tnfr.metrics`: `coherence`, `gradient`, `sense_index`, `phase_sync`
139
+ * `tnfr.viz`: plotting utilities (`plot_coherence`, `plot_network`, `plot_phase`)
140
+
141
+ Usage examples:
142
+
143
+ ```python
144
+ from tnfr import core, ops, sim, metrics
145
+
146
+ net = core.Network.from_edges([
147
+ ("n1", "n2", 0.6),
148
+ ("n2", "n3", 0.8),
149
+ ])
150
+
151
+ sequence = [ops.Emission(0.3), ops.Coupling(0.5), ops.Coherence()]
152
+ traj = sim.run(net, sequence, steps=500)
153
+
154
+ print(metrics.coherence(traj))
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Parametric modeling
160
+
161
+ ```python
162
+ import tnfr as T
163
+
164
+ net = T.Network.uniform(n=25, nu_f=0.4, coupling=0.3)
165
+ plan = (
166
+ T.ops.Emission(0.2)
167
+ >> T.ops.Expansion(0.4)
168
+ >> T.ops.Coupling(0.6)
169
+ >> T.ops.Coherence()
170
+ )
171
+ traj = T.sim.run(net, plan, steps=800)
172
+ T.viz.plot_phase(traj)
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Main metrics
178
+
179
+ * `coherence(traj) → C(t)`: global stability; higher values indicate sustained form.
180
+ * `gradient(state) → ΔNFR`: local demand for reorganization (high = risk of collapse/bifurcation).
181
+ * `sense_index(traj) → Si`: proxy for **structural sense** (capacity to generate shared coherence) combining **νf**, phase, and topology.
182
+
183
+ ---
184
+
185
+ ## Best practices
186
+
187
+ * **Short sequences** and frequent C(t) checks avoid unnecessary collapses.
188
+ * Use **dissonance** as a tool: introduce it to open possibilities, but **seal** with coherence.
189
+ * **Scale first, detail later:** tune coarse couplings before micro‑parameters.
190
+
191
+ ---
192
+
193
+ ## Project status
194
+
195
+ * **pre‑1.0 API**: signatures may be refined; concepts and magnitudes are stable.
196
+ * **Pure‑Python** core with minimal dependencies (optional: `numpy`, `matplotlib`, `networkx`).
197
+
198
+ ---
199
+
200
+ ## Contributing
201
+
202
+ Suggestions, issues, and PRs are welcome. Guidelines:
203
+
204
+ 1. Prioritize **operational clarity** (names, docstrings, examples).
205
+ 2. Add **tests** and **notebooks** that show the structural effect of each PR.
206
+ 3. Keep **semantic neutrality**: operators act on form, not on contents.
207
+
208
+ ---
209
+
210
+ ## License
211
+
212
+ MIT
213
+
214
+ ---
215
+
216
+ ## References & notes
217
+
218
+ * Theoretical foundations: TNFR operational manual.
219
+ * Operational definitions: nodal equation, dimensions (frequency, phase, form), and structural operators.
220
+
221
+ > If you use `tnfr` in research or projects, please cite the TNFR conceptual framework and link to the PyPI package.
@@ -1,4 +1,4 @@
1
- tnfr/__init__.py,sha256=c3fypVJdVZeV-AEZEPsr4NZZRwH9reGEBwoNnT9dP88,2788
1
+ tnfr/__init__.py,sha256=2j-PNqXRQxiMOsq6qEZ33XZ59vuqrvLXq7g4GCxAwDw,2790
2
2
  tnfr/cli.py,sha256=7OR3dlWUVjEKVH_itH-zYq8WQculXwSdCDDvmQH15kY,14372
3
3
  tnfr/config.py,sha256=bFc5AnLVoF0oUrSedAi5WpD6oCvn4hhLHO7WGgslg2M,1303
4
4
  tnfr/constants.py,sha256=XoUlTuUaQgQ6BbHzKSIHijqRMf9Gb3Avjo7_CLicgps,11570
@@ -9,7 +9,7 @@ tnfr/helpers.py,sha256=KT9_CAz3Z-WRKdARyGnsQ16m-p2z-l1-Y6UhVyY8tcU,8323
9
9
  tnfr/main.py,sha256=XqjI1YEdF-OqRzTMa5dYIxCig4qyAR-l1FPcyxpC8WY,1926
10
10
  tnfr/metrics.py,sha256=MTp0YifWdycW-jUFWhvxbJx-labWUR0thTnS0sxifrg,20259
11
11
  tnfr/node.py,sha256=A3nlaW_lwG0Q1dj6HPmyjfccWfZt4rwnzqPxTglu-Sk,6184
12
- tnfr/observers.py,sha256=PTw3hxk7KD-Yx_CvCIU09icuhyYD6uNU6SvF80UvP-Y,5354
12
+ tnfr/observers.py,sha256=7bdxYCXVDwHeSeeyI9IalogMuxaZYy2MafDs9rWEyQY,5979
13
13
  tnfr/ontosim.py,sha256=9GfEtiLIdJOPJUTufcq_MssAA9J8AfChHU6HKb3DIJY,5628
14
14
  tnfr/operators.py,sha256=TSY2LNIC-um3iSwniYiyu6oumnDwiES2zwb2B7ZbEZE,20536
15
15
  tnfr/presets.py,sha256=qFuDxlexc_kw--3VRaOx3cfyL6vPEOX_UVsJd2DNWAE,998
@@ -20,9 +20,9 @@ tnfr/structural.py,sha256=hE5_l7cuiPad9AuFVrFtnkJ8A8eL_e69gUN5VknkQiI,5155
20
20
  tnfr/trace.py,sha256=e_xdOOMZ5rqXOcdw99h8X1RnVuf_s9AeTzncqS551hE,4735
21
21
  tnfr/types.py,sha256=CnSwzzh9d0WgqB128y71iNWiiAA7Sf-eJ_v1xHMAwLo,507
22
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,,
23
+ tnfr-4.5.1.dist-info/licenses/LICENSE.md,sha256=SRvvhXLrKtseuK6DARbuJffuXOXqAyk3wvF2n0t1SWA,1109
24
+ tnfr-4.5.1.dist-info/METADATA,sha256=EQzW2AFCOyt8eVHWaqk5ka1MIzHCUn1IRRg8x1czxbA,8119
25
+ tnfr-4.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ tnfr-4.5.1.dist-info/entry_points.txt,sha256=j4-QRHqeT2WnchHe_mvK7npGTLjlyfLpvRONFe9Z4MU,39
27
+ tnfr-4.5.1.dist-info/top_level.txt,sha256=Q2HJnvc5Rt2VHwVvyBTnNPT4SfmJWnCj7XUxxEvQa7c,5
28
+ tnfr-4.5.1.dist-info/RECORD,,
@@ -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
- ```
File without changes