Skip to main content

SPARQ

Tests PyPI License

Spiking Physics-in-the-loop Autonomous Reinforcement triage of Quantum emitters: the installable sparq package behind the manuscript "Closed-loop, event-driven machine learning for autonomous triage of single-photon emitters." The manuscript's companion repository, a-spiking-RL-triage-of-solid-state-single-photon-emitters, holds the experiment scripts, figure scripts and results that reproduce the paper; this repository is the software's home for development, releases and support.

Installation

pip install sparq-triage        # physics core (numpy, scipy)
pip install sparq-triage[ml]    # adds PyTorch for the estimators, twin and RL

The core (sparq.physics, sparq.exact, sparq.pulsed) imports without PyTorch: the analytic HBT correlation functions, the exact-statistics histogram twin, the master-equation reference and the pulsed comb analysis.

import numpy as np
from sparq import HBTConfig, sample_site, expected_histogram

rng = np.random.default_rng(0)
site = sample_site(rng, platform="NV")     # literature-anchored priors
mu = expected_histogram(site, T_s=5.0, cfg=HBTConfig())
print(site.g2_0, site.is_good, mu.shape)

What is in the package

sparq/
  physics.py            emitter photophysics, platform priors, HBT twin
                        (exact Poisson histogram statistics) and the full
                        Monte-Carlo photon-stream simulator w/ detector
                        impairments
  exact.py              numerically exact master-equation g2(tau)
  pulsed.py             pulsed-excitation twin + comb calibration +
                        conventional peak-area analysis
  datasets.py           synthetic acquisition generators + loader for the
                        real sps-quality quantum-dot HBT data
  estimators.py         LM-fit baseline, CNN, surrogate-gradient spiking
                        network, physics-in-the-loop training
  twin_torch.py         differentiable twin (adjoint/pathwise gradients
                        through the measurement protocol) + profile
                        Fisher information
  sac_per.py            discrete-action Soft Actor-Critic + prioritized
                        experience replay (sum-tree)
  rl_env.py             closed-loop emitter-triage environment + baselines
  gnn.py                level-structure template graphs + message-passing
                        encoder for cross-platform transfer

Tests

pip install -e .[test]
pytest tests -q     # a few seconds; ML tests skip when torch is absent

The suite pins the physics to exact references: the two-exponential g2 law against the master-equation eigen-decomposition, the closed-form IRF convolution against brute-force quadrature, Poisson statistics of the histogram twin, comb calibration and peak-area recovery, sum-tree replay proportionality, and the shape/gradient contracts of the estimators, the differentiable protocol twin and the triage environment. It runs in CI on every push and pull request.

Real data

The experimental quantum-dot HBT measurements used by sparq.datasets.load_fisequr are from the openly licensed sps-quality repository (Kedziora et al., Mach. Learn.: Sci. Technol. 4, 045042 (2023)); they are not redistributed here.

Contributing and support

Bug reports, questions and pull requests are welcome through GitHub issues; see CONTRIBUTING.md for the development setup and the design rules. Tagged releases are published to PyPI by CI.

License and citation

Apache-2.0 (see LICENSE). Please cite the associated paper if you use this code; citation metadata is in CITATION.cff.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparq_triage-0.1.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

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

sparq_triage-0.1.0-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file sparq_triage-0.1.0.tar.gz.

File metadata

  • Download URL: sparq_triage-0.1.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sparq_triage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 24337efa71888b6316189bdefc05b41b823a6cae15148d9833dc4601b145a3dc
MD5 cda66ebb1574ef5dddc479dd13d19ef0
BLAKE2b-256 c8686d6f3abe811a9afc4b5c01cbe60699a069ffb70f9de3310869644699cf97

See more details on using hashes here.

Provenance

The following attestation bundles were made for sparq_triage-0.1.0.tar.gz:

Publisher: publish.yml on TaN-MM-Org/sparq-triage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sparq_triage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sparq_triage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sparq_triage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cbc55f38bf5cc895c70fcdbc9ec53a72555d16129317f38cb92384b5b655ddb
MD5 89b942acf62afedd33fe5a5d3fb16b98
BLAKE2b-256 df4193b3d80fc7dfc7eb0969462cb693fa09a82f643b69100672c79b7cdd3df6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sparq_triage-0.1.0-py3-none-any.whl:

Publisher: publish.yml on TaN-MM-Org/sparq-triage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page