Skip to main content

Compact multipolar toolkit

Project description

DOI

Loka Light

Conceptual intro

  • Multipolarity: signals are distributions over N poles instead of binary (+/−); LokaCn and MultipolarValue keep the algebra and Σ‑balance.
  • Pseudomultipolar cascades: Σ is controlled by M/N/NX stages (physics.sigma, devices.sigma_guard.SigmaGuard) so that a common component is removed before decoding.
  • Volumetric path (lightweight): MultipolarOscillator → TX/RX antennas → receiver form a simple medium/communication chain; geometry_profile is a label, not a full 3D field model.
  • Pseudo‑quantum layer: CPU/NumPy states via MultiConjugateFunction with scalar probability_density() (= Σ|ψ|^k, k=n_conjugates) and tensor probability_tensor() for simple “quantum‑like” experiments.

Minimal code examples

1. Basic 4‑pole loka and Σ‑aware value

from loka_light.core.algebras import LokaCn
from loka_light.core.value import MultipolarValue

loka = LokaCn(4, "add", "C4_add", ["A", "B", "C", "D"])
mv = MultipolarValue(loka, {"A": 1.0, "C": -1.0})

print("mv:", mv)
print("collapsed:", mv.collapse())  # complex number with Σ structure

2. SigmaGuard as a one‑line Σ→0 purification

from loka_light.core.algebras import LokaCn
from loka_light.core.value import MultipolarValue
from loka_light.devices.sigma_guard import SigmaGuard

loka = LokaCn(3, "add", "C3_add", ["P0", "P1", "P2"])
mv = MultipolarValue(loka, {"P0": 1.0, "P1": 0.5, "P2": -0.2})

guard = SigmaGuard()
mv_clean = guard.apply(mv)

print("residual before:", guard.residual(mv))
print("residual after:", guard.residual(mv_clean))

3. Simple pseudo‑quantum state with tensor metric

import numpy as np
from loka_light.physics.multipolar_wave import MultiConjugateFunction

psi = MultiConjugateFunction([1.0 + 0.0j, 1.0j], n_conjugates=2)

print("probability_density:", psi.probability_density())
print("probability_tensor:\n", psi.probability_tensor())

Installation

pip install loka-light

Development

python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]

Running Demo Scenarios with python

Each scenario is a plain function living under loka_light.applications.scenarios. Invoke them with python - <<'PY' ... PY blocks (or adapt for your favourite runner). The commands below write their artefacts into runs/ subdirectories.

1. Object Polarity Scan

python - <<'PY'
from loka_light.applications.scenarios import object_polarity_scan
object_polarity_scan({})
PY

2. Secure Transmission Chain

python - <<'PY'
from loka_light.applications.scenarios import secure_transmission
secure_transmission({})
PY

Note on regimes: the secure chain uses the volumetric path (oscillator → TX/RX antennas → receiver) for propagation in a medium, while Σ‑projection (M/N) is a separate pseudomultipolar stage (see devices/sigma_guard.py) applied at O2/O3 to remove the common component before decoding.

3. Electrolyser Stage Update

python - <<'PY'
from loka_light.applications.scenarios import electrolyser_stage
electrolyser_stage({})
PY

4. Polarisation Field Split

python - <<'PY'
from loka_light.applications.scenarios import polarization_field
polarization_field({})
PY

5. Property Transfer Chain with Shared Mind

python - <<'PY'
from loka_light.applications.scenarios import property_transfer_chain
property_transfer_chain({})
PY

6. Structuring Field Application

python - <<'PY'
from loka_light.applications.scenarios import structuring_field
structuring_field({})
PY

7. Pseudo M→NX→RX Chain (Σ trace)

python - <<'PY'
from loka_light.applications.scenarios import pseudo_mnx_chain
pseudo_mnx_chain({"n": 6, "k": 3, "sections": 3, "bits": [1,0,1]})
PY

Writes runs/pseudo_mnx_chain/trace.json with the |Σ| values after each NX section and the decoded index after Σ purification.

8. Pseudo‑Quantum H→Phase→H→Measure

python - <<'PY'
from loka_light.applications.scenarios import pseudo_quantum_hadamard_phase

pseudo_quantum_hadamard_phase({
    "shots": 256,
    "phase_angle": 1.0471975512,  # ~pi/3
    # "outdir": "runs/pseudo_quantum_hadamard",  # optional
})
PY

Writes summary.json under the chosen outdir with the measurement histogram, Σ trace by stage and a snapshot of the final state.

Cascade Map (M → N/NX → RX)

  Pseudomultipolar (network)                       Volumetric (field)
  ┌──────────────┐   O1    ┌─────────┐   O2  ┌──────────┐  medium ┌──────────┐   O3  ┌──────────┐
  │  Block M     ├────────►│  N / NX │──────►│ TX ant.  │────────►│ RX ant.  │──────►│  Decoder │
  │ (sum 2‑pole) │  rel.G  │ Σ→0     │ rel.G │ gain+loss│         │ gain+loss│       │ (argmax) │
  └──────────────┘         └─────────┘       └──────────┘         └──────────┘       └──────────┘
  • O1 (relative ground): summation node of PseudoBlockM (pseudomultipolar M‑stage).
  • O2 (relative ground): SigmaGuard applies N or NX to drive Σ→0 before decode.
  • TX/RX antennas: use gain and optional loss_db to model simple attenuation.
  • Frequency: carried in WaveMetadata.frequency_hz and used by the receiver for compatibility.

Relevant APIs

  • M‑stage: devices.pseudomultipolar.PseudoBlockM, devices.pseudomultipolar.BipolarSource.
  • Σ‑stage: physics.sigma (P⊥/N/NX), devices.sigma_guard.SigmaGuard.
  • Volumetric: devices.sources.MultipolarOscillator (with geometry_profile label), devices.communication.MultipolarAntenna (gain/loss), devices.detectors.MultipolarReceiver.

Pass keyword arguments through the dictionary literal to tweak behaviour; for example, set {"outdir": "runs/custom_scan", "true_polarity": 8} when calling object_polarity_scan.

Direct Device Experiments

Sample notebook-free loop for the devices:

python - <<'PY'
from loka_light.cognition.models import NPoleMind
from loka_light.devices.sources import MultipolarOscillator, NBranchInductor, MultiPlateCapacitor
from loka_light.devices.communication import MultipolarTransmitter
from loka_light.devices.detectors import MultipolarReceiver

mind = NPoleMind(n=4, output_mode="mv")
inductor = NBranchInductor("L", ("n1", "n2"), n_branches=1, l_each=1e-3)
capacitor = MultiPlateCapacitor("C", ("n1", "n2"), n_plates=2, c_single=1e-6)

osc_tx = MultipolarOscillator([inductor], [capacitor], mind=mind)
osc_rx = MultipolarOscillator([inductor], [capacitor], mind=mind)

transmitter = MultipolarTransmitter(osc_tx, mind=mind)
receiver = MultipolarReceiver(osc_rx, mind=mind)

wave = transmitter.transmit([1, 2, 3])
receiver.receive(wave)
print(receiver.demodulate())
PY

Pseudo‑Quantum CPU Simulator (multipolar)

The CPU implementation of the pseudo‑quantum simulator lives under loka_light.simulation.multipolar_pseudo_quantum and works directly with MultiConjugateFunction states.

Quick inline demo:

python - <<'PY'
import numpy as np

from loka_light.simulation import multipolar_pseudo_quantum as mpq

# Minimal H → phase → H → measure scenario
summary = mpq.hadamard_phase_measure_demo(shots=256, seed=42)
print("counts:", summary["counts"])

# Inspect correctness vs analytic reference
report = mpq.single_qubit_correctness_demo(phase_angle=np.pi/3, shots=1024, seed=123)
print("variation_distance:", report.variation_distance)
PY

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

loka_light-1.1.0.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

loka_light-1.1.0-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

Details for the file loka_light-1.1.0.tar.gz.

File metadata

  • Download URL: loka_light-1.1.0.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for loka_light-1.1.0.tar.gz
Algorithm Hash digest
SHA256 af958db87ef193339112b5c0534876dab2b6b97aaed1cc3253f3f5a7cfe14452
MD5 302621f69a979d8d1627af96315c7bbf
BLAKE2b-256 8c62a31a069f08968bae60bc17b77e0cd10459d85a5459d039567dadf07f445b

See more details on using hashes here.

File details

Details for the file loka_light-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: loka_light-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 54.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for loka_light-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd70c0b91237dccdaed2200fa386526a0aa14bc4b1c5c1a47bd21566c597ccb0
MD5 c6976c06a341b71d481540d098e8a661
BLAKE2b-256 bc1fd58cb398308f4f40c08c24ecd36408ecb4953d4b900ba2f874c8b30115c1

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