Skip to main content

SPEKTRAN

Open-source simulation engines, data standards, and ML benchmarks for physical sensing — every modality where physically rigorous synthetic training data can be generated.

SPEKTRAN builds one platform pattern — parameterized forward physics + literature-anchored instrument-noise chains + reproducible benchmark splits — and applies it modality by modality. The first shipped domain is laser gas absorption spectroscopy (TDLAS): fully reproducible synthetic spectra with realistic instrument noise (laser scan nonlinearity, etalon fringes, 1/f noise, baseline drift) and standardized tasks for concentration regression, spectral denoising, and cross-instrument generalization. NDIR, photoacoustic, and cavity-ringdown spectroscopy are the next planned techniques; the record schema carries a technique field from day one so new modalities extend, not fork, the standard.

⚠️ Status: alpha. Gates G1–G5 (naming, schema completeness, physics correctness, noise realism, cold-start usability) all pass with archived adversarial reviews; APIs and schema v0.1 may still change until v1.0.

Why SPEKTRAN?

Machine learning for physical sensing lacks what computer vision has had for a decade: standard datasets, standard tasks, and comparable baselines. Every paper simulates (or measures) its own signals, with its own noise assumptions, and reports metrics nobody else can reproduce.

SPEKTRAN attacks this with three assets:

  1. A parameterized simulation engine — HITRAN-based forward physics (direct absorption and wavelength-modulation spectroscopy) plus a modular instrument-noise chain modeled after real hardware.
  2. A data standard — a JSON Schema for spectra records with explicit units, full provenance (generator version, random seed, every sampled noise parameter), and a technique field ready for NDIR / PAS / CRDS extensions.
  3. A tiered benchmark — official train/val/test splits, three difficulty levels, and a flagship cross-instrument generalization track built on held-out virtual instruments.

All shipped data is simulation-born and labeled data_origin: simulated. The sim-to-real gap is not hidden — it is the research topic of the generalization track.

Quick start

Zero-install data access (Hugging Face):

from datasets import load_dataset
ds = load_dataset("spektran/spektran-ch4-v0")  # train/validation/test/test_heldout_instrument

Full engine + benchmark tooling:

git clone https://github.com/spektran/spektran
cd spektran
pip install -e ".[dev]"
from spektran.physics import simulate_absorbance

# Clean CH4 direct-absorption spectrum near 6046.9 cm-1 (1653 nm, 2v3 band)
nu, absorbance = simulate_absorbance(
    molecule="CH4",
    concentration_ppm=100.0,
    temperature_K=296.0,
    pressure_atm=1.0,
    path_length_m=10.0,
    wavenumber_start_cm1=6046.0,
    wavenumber_end_cm1=6048.0,
)

Benchmark tasks

Task Input Output Primary metric
T1 Concentration regression Noisy raw scan (DA) CH₄ concentration (ppm) MAE, MAPE
T2 Denoising / baseline correction Raw spectrum with fringes & drift Clean absorbance spectrum RMSE, peak-weighted RMSE
T3 Cross-instrument generalization Same as T1, held-out instruments Concentration (ppm) Generalization MAE, degradation vs T1

Leaderboard (v0 splits, CH4 DA)

Model T1 MAE (ppm) T1 MAPE (%) T3 MAE (ppm) T3 degradation
Ridge regression (baseline) 2.84 29.9 3.72 1.31x
1D CNN (baseline) 15.58 42.2 28.30 1.82x

T2 denoising (same test split): wing-anchored cubic-polynomial baseline (classical reference) — spectral RMSE 6.31e-3, peak-weighted RMSE 8.60e-3.

Reproduce with baselines/README.md. Note the T3 lesson already visible in the baselines: the deep model overfits instrument signatures harder than the linear one. Submissions: run python -m spektran.benchmark.evaluate on your predictions and open a PR adding your row with a link to reproducible code.

Project quality gates

Development is gated by automated, quantitative checkpoints (G1 naming … G5 cold-start usability). Every gate report is version-controlled under gates/reports/ as public evidence. Physics correctness is enforced by dual-implementation cross-validation (independent reference implementations in tests/reference_impl/) and CI tests against HITRAN/hapi references.

Citing

See CITATION.cff. A Zenodo DOI will be minted at v1.0.

Contributing

See CONTRIBUTING.md. Data contributions require the Data Submission Agreement (CC BY 4.0 grant).

Download files

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

Source Distribution

spektran-0.1.0.tar.gz (112.4 kB view details)

Uploaded Source

Built Distribution

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

spektran-0.1.0-py3-none-any.whl (52.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spektran-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b8d2c4f8348141fd319a7502e79cb090c4673da290ab32010064d54d0eda7d5
MD5 7699b74603436027bdb023d6b9fc0118
BLAKE2b-256 83ee35c2b32db641e2a35742abf60d16aeade34c99053b71cfcb7a709a7623e8

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on spektran/spektran

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

File details

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

File metadata

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

File hashes

Hashes for spektran-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08568d21ebb6c58b97188a510cdd38b2c640316ccc6ef9ed1cf984c5b17527a0
MD5 1d2417a52dfd3e5b91f9a2b60fe51f1c
BLAKE2b-256 fa4e9bc92a6f2e0ca75db524b9adbc72c0dd0a780842a1a8caaf6451f8295435

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on spektran/spektran

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

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