Skip to main content

Nultra aperture math and rotating temporal gate primitives

Project description

nultra

nultra is a small Python library for building systems around the Nultra aperture:

A_gamma(t) = [0.5 * (1 + sin(omega * t + phi))] ** gamma

A_gamma,eta(t) = 0 if A_gamma(t) < eta
               = A_gamma(t) otherwise

The result is a deterministic temporal gate. When A_gamma,eta(t) == 0.0, the system is in a hard null plateau. Applications can use that plateau as the only valid moment for state transitions such as block proposals, checkpoints, maintenance updates, or simulation events.

Version 0.2.0 adds rotating aperture parameters. The tuple (omega, phi, gamma, eta) can rotate only during a valid null plateau, making future safe windows a moving target while keeping honest participants in sync.

Installation

pip install nultra

To run the optional NultraChain dashboard:

pip install "nultra[demo]"

Quickstart

from nultra import NultraOperator

op = NultraOperator(omega=0.5, gamma=2.0, eta=0.25)

t = 6.30
aperture = op.get_aperture(t)

if op.is_null_plateau(t):
    print("State transition allowed")
else:
    print("Gate is closed")

Blending State

The canonical Nultra blend is:

from nultra import NultraOperator

op = NultraOperator()

current_state = 10.0
candidate_state = 25.0

next_state = op.blend(current_state, candidate_state, t=1.5)

When the aperture is zero, the state is preserved. When it opens, the candidate state contributes according to the aperture value.

Rotating Aperture Parameters

Manual rotations are strictly gated:

from nultra import NultraOperator, RotationGateError

op = NultraOperator(omega=0.5, phi=0.0, gamma=2.0, eta=0.25)

try:
    event = op.rotate(t=6.30, reason="checkpoint")
except RotationGateError as exc:
    print(exc)
else:
    print(event.old_params)
    print(event.new_params)

Automatic rotation is timer-driven, but still plateau-gated:

from nultra import NultraOperator

op = NultraOperator(
    omega=0.5,
    gamma=2.0,
    eta=0.25,
    auto_rotate=True,
    rotation_interval_seconds=20,
)

for t in simulation_clock():
    event = op.maybe_auto_rotate(t)
    if event is not None:
        print("rotated", event.to_dict())

If the timer is due while the aperture is open, no rotation happens. The next null plateau accepts the rotation message.

Running the Demo

After installing the demo extra:

nultra demo

Then open:

http://127.0.0.1:5000

The dashboard includes:

  • live aperture graph
  • honest nodes and a Mallory attacker simulation
  • blockchain explorer
  • admin panel for aperture parameters
  • auto-rotation toggle
  • rotation interval control
  • manual plateau-gated rotation button
  • rotation countdown and flash banner

From a source checkout, this also works:

python run.py

Why This Is Useful

Nultra math is useful anywhere state transitions should be rare, timed, auditable, or coordinated:

  • permissioned blockchain consensus
  • checkpoint admission windows
  • anti-spam transaction gating
  • secure maintenance windows for edge devices
  • simulations where mutation should happen only at deterministic moments

The package does not claim to be a complete blockchain consensus protocol by itself. It provides the reusable aperture primitive and rotation machinery that larger blockchain, security, and simulation projects can build on.

Development

Run the tests from the project root:

python -m unittest

Build a wheel:

python -m build

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

nultra-0.2.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

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

nultra-0.2.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file nultra-0.2.0.tar.gz.

File metadata

  • Download URL: nultra-0.2.0.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nultra-0.2.0.tar.gz
Algorithm Hash digest
SHA256 315bf8f3abff11f54a5c913bbd39339a638d98d83362aaab73a1827f720ed6ee
MD5 8551ace89395c91335bbd6156da9af5a
BLAKE2b-256 297381910ccf49f71c5aae3f99f8456985d3220e68b723457cabfedb1390ed57

See more details on using hashes here.

File details

Details for the file nultra-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nultra-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nultra-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e313daea21af38bf82b40cea5a8841cdfe4d73f2c7f662b31f1f2385a2c7fb08
MD5 28c1a3c7f4e6ada06f2583d86ae3a404
BLAKE2b-256 12f29aa3efb7bcd3a4f0d5d0a4fc4a2edf9002ff55c5efdb1f4c3a23583fb063

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