HUB
Sign inSign up
quantumdecoherence-lab logo

credkellar/quantumdecoherence-lab

By credkellar

โ€ขUpdated 17 days ago

QuantumDecoherence-Lab: decoherence lab - Kraus channels, T1/T2, pointer states, 3-spin env. Sim!!!!

Image
Machine learning & AI
Developer tools
Data science
1

135

credkellar/quantumdecoherence-lab repository overview

โ QuantumDecoherence-Lab ๐ŸŒ€โš›๏ธ

Decoherence Lab โ€” Kraus Channels, T1/T2 Bookkeeping, Pointer States & Finite-Environment Recoherence โ€” by Darion Kellar

Educational decoherence lab in ONE pure-Python file, computed two honest ways. As channels: amplitude damping and pure dephasing as explicit Kraus operators on a hand-built 2x2 density matrix โ€” completeness sum K^dagger K = I verified to 0.00e+00 / 1.11e-16 before use โ€” with the square-root law computed from the matrices (at the labelled T1 = 50 us, damping takes the excited population by x0.367879 but the coherence only by x0.606531) and dephasing shown killing coherence by exactly e^-1 at T_phi = 80 us while leaving every population untouched. The textbook bookkeeping 1/T2 = 1/(2*T1) + 1/T_phi predicts T2 = 44.444444 us, and a least-squares fit of the composed channel's own decay curve recovers 44.444444 us (relative error 0.0). A five-state pointer survival table shows the Z basis states as exact fixed points while superpositions pay the full e^-1. As a mechanism: one qubit coupled to a finite environment of three labelled spins (g = 1.0, 1.7, 2.9), evolved as an exact 16-amplitude statevector โ€” the reduced coherence equals the environment branch overlap to <1e-12, collapses to 1.141e-06 at t = 9.24, and partially recoheres to 0.917439 at t = 25.90, while an exponential fitted to the initial collapse predicts 4.33e-19 there (max residual 0.917439, against 4.44e-16 for the true Kraus channel). A from-scratch kNN regime classifier labels (T1, T_phi, t) points coherent / dephasing-dominated / relaxation-dominated / pointer-stable from the lab's own policy.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: every lifetime is a LABELLED teaching number โ€” no qubit sat in a fridge, no device was measured, and nothing here is a specification, a benchmark, or a record. The recoherence is a finite-size artefact of a 3-spin universe, printed at full size and fenced: a macroscopic bath does not come back, and selling the toy comeback as a way to beat decoherence is a permanent HOLD gate (14 total).

โ ๐Ÿงฐ Tech Stack Badges & Full Architecture Tech Stack

โ ๐Ÿ’ป Core Programming Languages & Core Systems

Python Stdlib Only Network Deterministic License Kraus Environment

  • ๐Ÿ Python 3.12, pure standard library (cmath, math, hashlib, json, sys) โ€” zero dependencies, zero network, deterministic (double-run byte-identical)
  • ๐ŸŒ€ Channel core: 2ร—2 complex density matrices and Kraus operators built by hand โ€” amplitude damping K0 = diag(1, โˆš(1โˆ’ฮณ)), K1 = โˆš(ฮณ)ยท|0โŸฉโŸจ1|, phase-flip dephasing โ€” completeness ฮฃ Kโ€ K = I asserted to machine precision before any channel output is trusted
  • ๐Ÿ“‰ Lifetime bookkeeping: the composed channel's coherence curve is fitted by least squares in log space, and the fitted T2 is graded against 1/T2 = 1/(2ยทT1) + 1/T_phi โ€” agreement is a check, not an assumption
  • ๐Ÿ”ฌ Mechanism core: an exact 16-amplitude statevector for qubit + 3 environment spins under controlled-phase couplings, a partial trace done by index sums, and the branch-overlap product โˆ (1 + e^{โˆ’iยทg_kยทt})/2 asserted equal to the traced ฯ_01 at every sampled time
  • ๐Ÿง  TinyML kNN regime classifier (from scratch, stdlib): coherent / dephasing-dominated / relaxation-dominated / pointer-stable from (T1, T_phi, elapsed time), labels from the lab's own regime policy
  • ๐Ÿช‘ Council seats: Gemini Argon 4 DECIDER (names-only, tighten-only) + Muse advisor (never overrides HOLD) + Google Flow plan-only (rendered = False, live = 0)
โ โ›“๏ธ Web3 & Infrastructure
  • ๐Ÿšซ Not applicable โ€” honestly. No blockchain, no Web3, no tokens: the "infrastructure" in this lab is a density matrix, two Kraus channels, and a 3-spin toy universe inside one offline file. No fake badges here.
โ โš™๏ธ Platform Support & Hardware Architecture

Linux macOS Windows

  • ๐Ÿ–ฅ๏ธ Pure Python โ€” runs anywhere Python 3.12+ runs (Linux, macOS, Windows), plus the python:3.12-slim Docker image
  • ๐Ÿ”’ No hardware is controlled, ever: real qubits, cryostats, and control electronics are permanent HOLD gates (see the gate table below)
โ โšก Low-Level Infrastructure & Performance
  • ๐Ÿšซ No low-level code โ€” honestly. No C, no C++, no GPU, no compiled extensions: this is one interpreted Python file on purpose, so every matrix entry can be read, checked, and diffed. Performance here means honest algorithms โ€” closed-form channel parameters, an exact partial trace, and a 4,001-point scan of the environment curve โ€” all deterministic and byte-identical between runs.
โ ๐Ÿ› ๏ธ DevOps & Build Tools

Docker GitHub Actions pytest Git

  • ๐Ÿณ Docker (python:3.12-slim), GitHub Actions CI + Docker Publish (delivered in the paste pack)
  • ๐ŸŽฏ Target image: credkellar/quantumdecoherence-lab:latest
  • ๐Ÿงช Tests: pytest (32 tests) + the built-in CHECKS suite (47 checks) in main.py
โ โ˜๏ธ Cloud Providers
  • ๐Ÿšซ None โ€” honestly. No cloud provider is used or needed: the lab runs fully offline on your own machine or in a local Docker container. Docker Hub appears only as the registry the publish workflow pushes the image to.

โ ๐Ÿณ Quick start

docker pull credkellar/quantumdecoherence-lab:latest
docker run --rm credkellar/quantumdecoherence-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 47/47).

Run a specific command instead:

docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py checks      # CHECKS 47/47
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py channels    # Kraus channels + decay report (JSON)
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py lifetimes   # T1/T_phi -> fitted T2 vs the relation (JSON)
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py pointer     # pointer-state survival table (JSON)
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py environment # 3-spin mechanism: collapse + recoherence (JSON)
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py markov      # exponential residuals, both worlds (JSON)
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py classify    # kNN verdicts: coherent / dephasing / relaxation / pointer
docker run --rm credkellar/quantumdecoherence-lab:latest python3 main.py holds       # 14 HOLD gates

โ ๐Ÿ”ฌ What's inside

  • Kraus channels, completeness first โ€” amplitude damping and phase-flip dephasing as explicit 2x2 operator pairs; sum K^dagger K = I verified (errors 0.00e+00 and 1.11e-16), and trace, hermiticity, and positivity of every output state asserted in CHECKS.
  • The square-root law, computed โ€” damping at t = T1: population x0.367879 (= e^-1), coherence x0.606531 (= e^-1/2). The ground state is an exact fixed point; gamma = 1 lands exactly on |0>.
  • Dephasing, the silent killer โ€” coherence x0.367879 at t = T_phi with populations bit-for-bit unchanged, verified on a 0.7/0.3 mixture out to t = 400 us.
  • T2 fitted, not quoted โ€” predicted 44.444444 us from 1/(2*T1) + 1/T_phi at labelled T1 = 50, T_phi = 80; the composed channel's log-fit returns 44.444444 us, relative error 0.0; coherence at T2 is 0.183940 = 0.5/e.
  • Pointer survival table โ€” at t = T_phi: |0> and |1> untouched, |+> and |+i> coherence 0.500000 -> 0.183940, mixture coherence 0.200000 -> 0.073576 with populations pinned.
  • The mechanism โ€” qubit + 3 environment spins, exact 16-amplitude statevector, partial trace by index sums; reduced rho_01 equals 0.5 * prod (1 + e^(-i g_k t))/2 to <1e-12, populations pinned at 0.5/0.5 (pure dephasing with a visible cause).
  • Collapse + recoherence, sized โ€” factor falls to 1.141e-06 at t = 9.24 (purity at its 0.5 floor) and returns to 0.917439 at t = 25.90 โ€” printed with its finite-size fence, and recoherence-as-recovery is a HOLD gate.
  • Where the exponential ends โ€” Kraus channel vs its own exponential: max deviation 4.44e-16. Environment: initial-collapse fit (T = 0.612532) predicts 4.33e-19 at the recoherence peak vs the actual 0.917439; max residual 0.917439, RMS 0.344814.
  • TinyML kNN classifier โ€” coherent / dephasing-dominated / relaxation-dominated / pointer-stable from (T1, T_phi, t); labels generated by the lab's own regime policy, audited on every scenario and all 150 grid points.
  • Advisory seats โ€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

โ โœ… Verified

  • pytest: 32 passed
  • Built-in checks: CHECKS 47/47
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

โ ๐Ÿท๏ธ Categories

Science ยท Developer tools ยท Machine learning & AI

  • License: MIT ยฉ 2026 Darion Kellar
  • Image: credkellar/quantumdecoherence-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:f62afb097โ€ฆ
Size
41.5 MB
Last updated
17 days ago
docker pull credkellar/quantumdecoherence-lab:latest