The word pramāṇa (प्रमाण) means “valid cognition” — the means by which reliable knowledge is obtained. In the Buddhist epistemological tradition of Dignāga and Dharmakīrti, there are exactly two pramāṇas: direct perception (pratyakṣa) and inference (anumāna). A quantum sensor is a physical system that performs both: it perceives a field directly through its quantum state, and the measurement apparatus infers the field value from the sensor’s response.
MāyāPramāṇa is a pedagogical framework for understanding and building a Bell-Bloom atomic magnetometer — a quantum sensor that measures magnetic fields using optically pumped alkali atoms. The framework teaches the physics, the signal processing, and the control theory required to build a universal quantum sensor controller.
The Logic of the Instrument#
The magnetometer follows a signal chain: Prepare → Precess → Read Out → Process → Estimate → Control. Each stage is a lesson, each lesson is implemented in three languages (Python, Haskell, C++), and all three must agree on the physics.
Curriculum#
Architecture#
Three languages, one physics. Python for exploration (fast iteration, plotting). Haskell for specification (if it type-checks, the physics is consistent). C++ for deployment (real-time control on Red Pitaya FPGA). All three are tangled from the same .org source files.
Pure Core / Effectful Shell. Signal processing pipelines are inherently compositional: a lock-in amplifier is demodulate . filter . sample. Side effects (hardware I/O, logging, calibration) live at the boundary.
Source Material#
The full content lives in the mayapramana repository as literate .org files:
manifesto.org — epistemology of measurement, the pramāṇa frameworkcurriculum.org — master curriculum for the 10-lesson sequencearchitecture.org — why functional programming for signal processingapplications.org — quantum magnetometry for brain imaging (MEG)conventions.org — literate programming rules, directory structure
C++ is the deployment language of MāyāPramāṇa — the bridge from understanding to hardware. The same Bloch equation solver that runs interactively in Python and type-checks in Haskell must eventually execute in real-time on a Red Pitaya FPGA controlling an actual magnetometer.
Pure Core / Effectful Shell The architecture separates:
Pure core — physics, signal processing, estimation algorithms. No I/O, no global state, no allocations in the hot path. These are the same functions as in Haskell, translated to C++ templates. Effectful shell — hardware I/O (ADC/DAC), logging, calibration, network communication. Side effects are quarantined at the boundary. This separation makes the core testable, portable, and comprehensible. The shell adapts to the deployment target (Red Pitaya, desktop simulation, or browser via WebAssembly).
...
Haskell is the specification language of MāyāPramāṇa. If the Python track asks “what happens?”, the Haskell track asks “what must happen?” Types encode physical units, function signatures encode signal flow, and QuickCheck properties encode the laws of physics.
Why Haskell for Physics? Signal processing is inherently compositional. A lock-in amplifier is:
demodulate . lowpass . mix_with_reference . sample Each stage is a pure function; the pipeline is their composition. Haskell makes this composition explicit and type-safe. A Kalman filter is a state monad; a PID controller is a feedback arrow. The language’s abstractions map directly onto the physics.
...
The Bloch sphere is the geometric representation of a two-level quantum system — every point on the sphere corresponds to a pure state, every point inside to a mixed state. Watching a spin precess on the Bloch sphere builds intuition that no equation can replace.
What the Demo Will Show An interactive 3D Bloch sphere in the browser where the user can:
Apply a static field and watch Larmor precession Turn on optical pumping and see the state spiral toward the poles Add relaxation (T₁, T₂) and observe the magnetisation decay Sweep the RF field and find the resonance condition Compare the quantum spin dynamics with the Bloch vector approximation Applications Context The same physics drives optically pumped magnetometers (OPMs) used for:
...
“I think I can safely say that nobody understands quantum mechanics.” — Richard Feynman
The Bloch equations describe how a magnetic moment precesses, relaxes, and responds to resonant driving fields. They are the foundation of everything that follows in the magnetometer: optical pumping, Larmor precession, signal demodulation, and state estimation all reduce to solving these equations under different conditions.
What This Lesson Covers Starting from a single spin-½ in a static magnetic field, the lesson builds up to the full Bloch vector equations through:
...
Python is the exploration language of MāyāPramāṇa — the medium for quick experiments, interactive plots, and org-babel notebooks. When you want to see what happens when you change the pump rate or sweep the RF frequency, you reach for Python.
Role in the Three-Language Architecture Language Role Strength Python Exploration Fast iteration, plotting, org-babel integration Haskell Specification Type safety, QuickCheck property testing C++ Deployment Real-time performance, FPGA bridge The Python track implements the same physics as Haskell and C++, but optimises for readability and interactivity rather than performance or type safety. NumPy and SciPy handle the numerics; Matplotlib handles the visualisation; org-babel handles the narrative.
...