Skip to main content

Canonical TNFR: modular glyph-based dynamics on networks.

Project description

TNFR Python Project

Reference implementation of the Resonant Fractal Nature Theory (TNFR). It models glyph-driven dynamics on NetworkX graphs, providing a modular engine to simulate coherent reorganization processes.

General Project Structure

  • 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.

  • 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.

  • 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.

  • 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).

  • Glyph operators. operators.py defines the 13 glyphs as local transformations, a dispatcher aplicar_glifo, and both direct and stability-conditioned re-mesh utilities.

  • Observers & metrics. observers.py registers standard callbacks and computes global coherence, phase synchrony, Kuramoto order, glyph distribution, and the sense vector Σ⃗, among others.

  • Simulation orchestration. ontosim.py prepares a NetworkX graph, attaches configuration, and initializes attributes (EPI, phases, frequencies) before delegating dynamics to dynamics.step/run.

  • Demo CLI. main.py generates an Erdős–Rényi network, lets you tweak basic parameters, and runs the simulation while displaying final metrics.


Key Concepts to Grasp

  • Aliased dependency tree. Modules import each other via global aliases to simplify access and prevent cycles—essential for navigating the code unambiguously.

  • 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.

  • Sense Index (Si). Combines normalized frequency, phase dispersion, and field magnitude to evaluate each node’s “sense,” influencing glyph selection.

  • Step-wise engine. dynamics.step orchestrates eight phases: field computation, Si, glyph selection & application, integration, clamps, phase coordination, history update, and conditioned re-mesh.

  • Glyphs as operators. Each glyph applies a smooth transformation to node attributes (emission, diffusion, coupling, dissonance, etc.), dispatched by a configurable, typographic name.

  • 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.

  • Γ(R) coupling. Optional network term added to the nodal equation, parameterized by global phase order R with gain β and threshold R0 (see DEFAULTS["GAMMA"]).

  • Callbacks & observers. The Γ(R) system lets you hook functions before/after each step and after re-mesh, enabling monitoring or external intervention.


Recommendations for Going Deeper

  • NetworkX & the Graph API. Get comfortable with how NetworkX handles attributes and topology; all dynamics operate on Graph objects and their properties.

  • Extending the ΔNFR field. Explore set_delta_nfr_hook to implement alternative nodal fields and learn how metadata and mixing weights are recorded.

  • Designing new glyphs. Review operators.py to add operators or adjust factors in DEFAULTS['GLYPH_FACTORS'].

  • Custom observers. Implement your own metrics via register_callback or by extending observers.py to measure phenomena specific to your study.

  • Theoretical reading. For conceptual background, see the included PDFs (TNFR.pdf, El Pulso que nos Atraviesa), which deepen the fractal-resonant framework.

  • Advanced parameters. Experiment with adaptive phase coordination, stability criteria, and the glyph grammar to observe their impact on network self-organization.


Mastering these pieces will let you extend the simulation, build analysis pipelines and connect the theory with computational applications.

Optional Node environment

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.

Testing

Install the dependencies and project in editable mode before running the test suite with pytest:

pip install networkx
pip install -e .
pytest

Installation

pip install tnfr

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tnfr-4.5.0.tar.gz (59.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tnfr-4.5.0-py3-none-any.whl (61.5 kB view details)

Uploaded Python 3

File details

Details for the file tnfr-4.5.0.tar.gz.

File metadata

  • Download URL: tnfr-4.5.0.tar.gz
  • Upload date:
  • Size: 59.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for tnfr-4.5.0.tar.gz
Algorithm Hash digest
SHA256 8a8f3d687ae4931ac1b13b93596e26f8ac02fa1ad172b1f002ea8f57b24a3d85
MD5 7d5ff3e3c9784971801bf33a67cd13ed
BLAKE2b-256 3fc9ea7f19ccdd51689c6205d7f6a86f6e64970641ca9358b5eb35d840f23c8c

See more details on using hashes here.

File details

Details for the file tnfr-4.5.0-py3-none-any.whl.

File metadata

  • Download URL: tnfr-4.5.0-py3-none-any.whl
  • Upload date:
  • Size: 61.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for tnfr-4.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37d5baa75e9c48981ae5f8ac8546623267cca3c6c5e71c1faba04c234a48491c
MD5 e6f2ac48c418731fcb19013fa651e02d
BLAKE2b-256 79eb5959b0021765077a67f28c27ed2720c2ac41dadc0b2e2a3f450a2cbdb459

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page