Quantum Sensing Applications

Production-grade guide to quantum sensing applications covering architecture patterns, implementation strategies, testing approaches, and operational best practices for enterprise engineering teams.

Quantum sensing leverages quantum states—superposition, entanglement, and coherence—to measure physical quantities with precision beyond classical limits. It matters when sensing at the nanoscale, in noisy environments, or across wide dynamic ranges, such as detecting weak magnetic fields, gravitational waves, or temperature gradients with sensitivity approaching the standard quantum limit. This page details the practical execution of quantum sensing workflows, from experimental setup to data analysis, using real tools and patterns that apply across platforms.

Setting Up the Quantum Sensor

To deploy a quantum sensor, begin with initializing the quantum system—typically a qubit in a trapped ion, superconducting circuit, nitrogen-vacancy (NV) center in diamond, or cold atom ensemble. The initial state must be prepared with high fidelity, often via laser or microwave pulses. Use a standard pulse sequence specification language such as QASM (Quantum Assembly Language), which supports arbitrary gate definitions and timing.

// Initialize a single qubit in |0⟩ state
prep |0⟩
// Apply a π/2 pulse around X-axis
x90
// Wait for coherence time T2
wait 100000  // in nanoseconds
// Measure in Z-basis
measure z

This QASM code is executed on a real quantum processor via a control system that supports pulse-level programming, such as those from Zurich Instruments, Keysight, or SpinCore. Each pulse is defined with amplitude, frequency, phase, and duration, and can be time-stamped to nanosecond precision.

The control system exposes a REST API for configuration and execution. A typical request to start a sequence looks like:

POST /api/v1/sequences
Content-Type: application/json

{
  "sequence": "prep |0⟩\nx90\nwait 100000\nmeasure z",
  "parameters": {
    "repeats": 10000,
    "trigger": "external",
    "trigger_delay": 1500
  },
  "metadata": {
    "experiment_id": "2024-sensor-001",
    "sensor_type": "NV-center",
    "calibration_date": "2024-01-15"
  }
}

On success, the API returns a 202 status with a job ID:

{
  "job_id": "j-9a3f2c1d",
  "status": "queued",
  "submitted_at": "2024-04-10T12:34:56Z"
}

The sensor is now ready for data acquisition. A common failure occurs when the trigger_delay is misinterpreted: the control system applies the delay *before* the first pulse, not after the prep block, causing phase drift in the initial state. To correct this, explicitly include a trigger instruction in the QASM:

trigger 1500
prep |0⟩
x90
wait 100000
measure z

Acquiring Sensor Data

After configuring the sequence, data acquisition begins. The quantum processor outputs a stream of measurement outcomes—typically 0s and 1s for a qubit state—recorded as binary or JSON. The control system writes raw data to a file in HDF5 format, a standard for scientific data.

A typical HDF5 file contains:

Use h5py in Python to load and inspect the data:

import h5py
import numpy as np

with h5py.File("sensor-data-2024.h5", "r") as f:
    counts = f["/data/counts"][:]
    timestamps = f["/metadata/timestamps"][:]
    experiment_id = f["/metadata/experiment_id"][()].decode("utf-8")

    # Compute signal: probability of |1⟩
    p1 = np.mean(counts)
    print(f"Sensor response: {p1:.4f} (±{np.std(counts):.4f})")

If the sensor is measuring a time-varying magnetic field, the measurement sequence is repeated for different values of a control parameter—e.g., the detuning of a microwave drive. The control system collects multiple datasets, each tagged with the parameter value.

Data is organized in a directory hierarchy:

data/
├── 2024-sensor-001/
│   ├── detuning=0.0MHz.h5
│   ├── detuning=0.5MHz.h5
│   └── detuning=1.0MHz.h5
└── 2024-sensor-002/
    ├── detuning=-0.3MHz.h5
    └── detuning=0.7MHz.h5

Each dataset can be indexed via a metadata database. Use a lightweight SQL database such as SQLite to register experiments:

CREATE TABLE experiments (
    id INTEGER PRIMARY KEY,
    experiment_id TEXT UNIQUE,
    sensor_type TEXT,
    calibration_date DATE,
    created_at DATETIME
);

CREATE TABLE datasets (
    id INTEGER PRIMARY KEY,
    experiment_id TEXT,
    parameter_key TEXT,
    parameter_value REAL,
    file_path TEXT,
    FOREIGN KEY (experiment_id) REFERENCES experiments(experiment_id)
);

A common failure occurs when the parameter_value is stored as a string instead of a float, leading to mismatched keys when joining datasets. The query to retrieve all data for a fixed detuning must explicitly cast:

SELECT d.parameter_value, d.file_path, e.sensor_type
FROM datasets d
JOIN experiments e ON d.experiment_id = e.experiment_id
WHERE d.parameter_key = 'detuning'
  AND CAST(d.parameter_value AS REAL) = 0.5
ORDER BY d.id;

Processing Sensor Signals

Raw data must be processed to extract physical quantities. The most common step is fitting the measured signal—typically the probability of |1⟩—to a model, such as a Lorentzian or Gaussian peak.

Use scipy.optimize.curve_fit in Python to fit a Lorentzian function to a dataset:

from scipy.optimize import curve_fit
import numpy as np

def lorentzian(x, x0, gamma, A, offset):
    return A * gamma / (2 * np.pi * ((x - x0)**2 + gamma**2)) + offset


with h5py.File("detuning=0.5MHz.h5", "r") as f:
    counts = f["/data/counts"][:]
    detuning = f["/metadata/detuning"][:]

p1 = np.mean(counts)
x0_guess = np.mean(detuning)
gamma_guess = 0.1
A_guess = 0.5
offset_guess = 0.1

# Fit
popt, pcov = curve_fit(
    lorentzian,
    detuning,
    p1,
    p0=[x0_guess, gamma_guess, A_guess, offset_guess],
    sigma=np.sqrt(p1 * (1 - p1) / len(counts)),
    absolute_sigma=True
)

# Extract results
fitted_x0, fitted_gamma, fitted_A, fitted_offset = popt
fitted_uncertainty = np.sqrt(np.diag(pcov))

The curve_fit function returns a covariance matrix, from which uncertainties on all parameters are derived. A critical failure mode is neglecting the measurement uncertainty in the sigma argument: without it, the fit is overly confident, and the estimated linewidth (gamma) is underestimated.

The fit results are stored in a new HDF5 group:

with h5py.File("detuning=0.5MHz.h5", "a") as f:
    fit_group = f.create_group("/fit/lorentzian")
    fit_group.attrs["method"] = "scipy.optimize.curve_fit"
    fit_group.attrs["model"] = "lorentzian"
    fit_group["parameters"] = popt
    fit_group["uncertainties"] = fitted_uncertainty
    fit_group["chi2"] = np.sum((p1 - lorentzian(detuning, *popt))**2)

Calibration and Feedback

A quantum sensor’s performance depends on calibration—mapping raw measurements to physical units. This is done by exposing the sensor to known reference fields and fitting a calibration curve.

Use numpy.polynomial.Polynomial to fit a polynomial response function:

from numpy.polynomial import Polynomial

# Known magnetic field strengths and measured probabilities
fields = np.array([0.0, 0.1, 0.2, 0.3, 0.4])  # in Tesla
probabilities = np.array([0.48, 0.52, 0.56, 0.61, 0.64])

# Fit calibration curve
calibration = Polynomial.fit(fields, probabilities, deg=2)

# Save to file
import pickle
with open("calibration.pkl", "wb") as f:
    pickle.dump(calibration, f)

# Load and apply
with open("calibration.pkl", "rb") as f:
    cal = pickle.load(f)

magnetic_field = cal(0.58)  # estimate field for p1 = 0.58

The calibration is applied in real time during data acquisition. The control system reads the calibration.pkl file and uses it to convert raw counts to physical values.

A common pitfall is using a calibration from one sensor in a different environment—e.g., a room-temperature calibration applied to a cryogenic sensor. The temperature-dependent drift in the qubit frequency causes a systematic error. To detect this, include a reference signal: a known, stable magnetic field applied continuously during calibration.

The control system logs the reference signal as a separate time series:

{
  "reference": {
    "name": "constant_field",
    "value": 0.25,
    "unit": "T",
    "start_time": 1712700000000,
    "end_time": 1712700500000
  }
}

A failure mode arises when the reference signal is not synchronized with the measurement: the control system records the reference signal at a different timestamp resolution than the qubit measurements. To align them, use a common timebase—e.g., a GPS-synchronized clock—and interpolate the reference signal to match the measurement timestamps.

Deploying and Monitoring the Sensor

For long-term operation, the sensor runs continuously. Use systemctl to manage the control system as a daemon:

# /etc/systemd/system/sensor-control.service
[Unit]
Description=Quantum Sensor Control System
After=network.target

[Service]
Type=simple
User=quantum
ExecStart=/usr/bin/sensor-control --config /etc/sensor/config.yaml
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

The config.yaml file uses standard YAML syntax with key-value pairs:

sensor:
  type: "NV-center"
  qubit: "1"
  control_system:
    host: "192.168.1.10"
    port: 5000
    timeout: 30s

acquisition:
  repeats: 10000
  trigger: "external"
  trigger_delay: 1500
  sampling_rate: 1000000  # 1 MHz

calibration:
  file: "/data/calibration.pkl"
  reference:
    name: "constant_field"
    value: 0.25
    unit: "T"
    duration: 600000  # ms

The sensor system logs messages at different severity levels using journalctl:

# View all logs
sudo journalctl -u sensor-control.service -f

# Filter by level
sudo journalctl -u sensor-control.service --since="2024-04-10" | grep -E "(ERROR|WARNING)"

# Check for dropped pulses
journalctl -u sensor-control.service | grep "Dropped pulse"

A silent failure occurs when the control system misses a trigger pulse due to buffer overflow. The logs show:

ERROR: sensor-control: Pulse buffer overflow at 1712700234567
  - Expected 10000 pulses, received 9987
  - Missing pulses: 13
  - Last missed: 1712700245678

This indicates a mismatch between the expected and actual pulse rates, requiring tuning of the buffer size or real-time processing pipeline.

Common Failure Modes and Debugging

Each of these patterns is portable across platforms: the same data format, API, SQL schema, and failure mode apply whether the system uses Zurich Instruments, Keysight, or a custom Python-based controller. The reader can adapt this entire workflow to their existing tooling without introducing new abstractions.

This page was rewritten on 13 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.