tnfr 4.5.1__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.

Files changed (78) hide show
  1. tnfr/__init__.py +91 -90
  2. tnfr/alias.py +546 -0
  3. tnfr/cache.py +578 -0
  4. tnfr/callback_utils.py +388 -0
  5. tnfr/cli/__init__.py +75 -0
  6. tnfr/cli/arguments.py +177 -0
  7. tnfr/cli/execution.py +288 -0
  8. tnfr/cli/utils.py +36 -0
  9. tnfr/collections_utils.py +300 -0
  10. tnfr/config.py +19 -28
  11. tnfr/constants/__init__.py +174 -0
  12. tnfr/constants/core.py +159 -0
  13. tnfr/constants/init.py +31 -0
  14. tnfr/constants/metric.py +110 -0
  15. tnfr/constants_glyphs.py +98 -0
  16. tnfr/dynamics/__init__.py +658 -0
  17. tnfr/dynamics/dnfr.py +733 -0
  18. tnfr/dynamics/integrators.py +267 -0
  19. tnfr/dynamics/sampling.py +31 -0
  20. tnfr/execution.py +201 -0
  21. tnfr/flatten.py +283 -0
  22. tnfr/gamma.py +302 -88
  23. tnfr/glyph_history.py +290 -0
  24. tnfr/grammar.py +285 -96
  25. tnfr/graph_utils.py +84 -0
  26. tnfr/helpers/__init__.py +71 -0
  27. tnfr/helpers/numeric.py +87 -0
  28. tnfr/immutable.py +178 -0
  29. tnfr/import_utils.py +228 -0
  30. tnfr/initialization.py +197 -0
  31. tnfr/io.py +246 -0
  32. tnfr/json_utils.py +162 -0
  33. tnfr/locking.py +37 -0
  34. tnfr/logging_utils.py +116 -0
  35. tnfr/metrics/__init__.py +41 -0
  36. tnfr/metrics/coherence.py +829 -0
  37. tnfr/metrics/common.py +151 -0
  38. tnfr/metrics/core.py +101 -0
  39. tnfr/metrics/diagnosis.py +234 -0
  40. tnfr/metrics/export.py +137 -0
  41. tnfr/metrics/glyph_timing.py +189 -0
  42. tnfr/metrics/reporting.py +148 -0
  43. tnfr/metrics/sense_index.py +120 -0
  44. tnfr/metrics/trig.py +181 -0
  45. tnfr/metrics/trig_cache.py +109 -0
  46. tnfr/node.py +214 -159
  47. tnfr/observers.py +126 -136
  48. tnfr/ontosim.py +134 -134
  49. tnfr/operators/__init__.py +420 -0
  50. tnfr/operators/jitter.py +203 -0
  51. tnfr/operators/remesh.py +485 -0
  52. tnfr/presets.py +46 -14
  53. tnfr/rng.py +254 -0
  54. tnfr/selector.py +210 -0
  55. tnfr/sense.py +284 -131
  56. tnfr/structural.py +207 -79
  57. tnfr/tokens.py +60 -0
  58. tnfr/trace.py +329 -94
  59. tnfr/types.py +43 -17
  60. tnfr/validators.py +70 -24
  61. tnfr/value_utils.py +59 -0
  62. tnfr-4.5.2.dist-info/METADATA +379 -0
  63. tnfr-4.5.2.dist-info/RECORD +67 -0
  64. tnfr/cli.py +0 -322
  65. tnfr/constants.py +0 -277
  66. tnfr/dynamics.py +0 -814
  67. tnfr/helpers.py +0 -264
  68. tnfr/main.py +0 -47
  69. tnfr/metrics.py +0 -597
  70. tnfr/operators.py +0 -525
  71. tnfr/program.py +0 -176
  72. tnfr/scenarios.py +0 -34
  73. tnfr-4.5.1.dist-info/METADATA +0 -221
  74. tnfr-4.5.1.dist-info/RECORD +0 -28
  75. {tnfr-4.5.1.dist-info → tnfr-4.5.2.dist-info}/WHEEL +0 -0
  76. {tnfr-4.5.1.dist-info → tnfr-4.5.2.dist-info}/entry_points.txt +0 -0
  77. {tnfr-4.5.1.dist-info → tnfr-4.5.2.dist-info}/licenses/LICENSE.md +0 -0
  78. {tnfr-4.5.1.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
@@ -1,221 +0,0 @@
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,28 +0,0 @@
1
- tnfr/__init__.py,sha256=2j-PNqXRQxiMOsq6qEZ33XZ59vuqrvLXq7g4GCxAwDw,2790
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=7bdxYCXVDwHeSeeyI9IalogMuxaZYy2MafDs9rWEyQY,5979
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.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,,
File without changes