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 (v0.2.0). Gates G1–G5 all pass with archived adversarial reviews. Multi-species support (CH4, H2O, CO2, CO), higher-harmonic WMS (3f/4f), and 6 benchmark tasks now available. APIs and schema 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, six tasks (concentration regression, denoising, cross-instrument generalization, WMS concentration, drift compensation, OOD detection), 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,
)
# Multi-species: CH4 with H2O interferent
from spektran.physics import demo_ch4_2nu3, demo_h2o, absorption_coefficient
import numpy as np

nu = np.linspace(6046.0, 6048.0, 2000)
alpha_ch4 = absorption_coefficient(nu, demo_ch4_2nu3(), 100e-6, 296.0, 1.0)
alpha_h2o = absorption_coefficient(nu, demo_h2o(), 0.01, 296.0, 1.0)  # 1% H2O

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
T4 WMS concentration Noisy 2f signal (WMS) CH₄ concentration (ppm) MAE
T5 Drift compensation Time-series raw scans Drift-corrected concentrations Allan variance improvement
T6 OOD instrument detection Raw scan In-dist vs OOD binary AUROC

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.

CLI

spektran generate configs/datasets/ch4-t1-train-v0.yaml --out data
spektran benchmark --task T1-concentration --truth data/test.h5 --predictions preds.csv
spektran validate data/ch4-t1-train-v0.h5
spektran download

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.2.0.tar.gz (125.6 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.2.0-py3-none-any.whl (60.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spektran-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d1f653bb5bfe3177a66904ce28ea98e0fc8d32fd31a9c0e079d07b499edf9972
MD5 75ebbf2f51f49a97ab2049e2f74c7d36
BLAKE2b-256 af0d12fdab7bb654b011bed2c21d7b8fda79b3bdad408e779d40045004a21b42

See more details on using hashes here.

Provenance

The following attestation bundles were made for spektran-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: spektran-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 60.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 effe83cbf3ecfba43900880dbed2afdd8ef21fa23f50662f3ce15135dedaa34d
MD5 8e3d0dcfa247dc58d99799ea50719162
BLAKE2b-256 9930ecf02da5e1c675d50d50e0d0730e1622d1c2f10387c0e9ec9338917a917c

See more details on using hashes here.

Provenance

The following attestation bundles were made for spektran-0.2.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