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.5.0). Two modalities: TDLAS (10 molecules, 14+ instruments, 9 tasks, 12+ baselines) and NDIR (4 instruments, concentration regression). 9 benchmark tasks (T1-T9) including multi-species regression, temperature regression, and cross-modality transfer. Hartmann-Tran Profile (HTP), WMS 2f/1f ratio, laser RIN, isotopologue handling. Public leaderboard. 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
T7 Cross-modality transfer TDLAS train, NDIR test Concentration (ppm) MAE, degradation vs T1
T8 Multi-species regression Raw scan (DA), CH4+H2O CH4 + H2O concentrations (ppm) Aggregate MAE
T9 Temperature regression Raw scan (DA), fixed conc Gas temperature (K) MAE

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

Deep learning baselines also available: Patchified Transformer (T1/T4), 1D U-Net (T2 denoising), TCN (T5 drift compensation).

T2 denoising: wing-anchored cubic-polynomial baseline — spectral RMSE 6.31e-3, peak-weighted RMSE 8.60e-3. T4 WMS: ridge 15.15 ppm MAE, 1D CNN 20.35 ppm MAE. T5 drift: moving-average baseline 0.270 ppm MAE. T6 OOD: PCA + Mahalanobis 0.672 AUROC. T8 multi-species: ridge CH4 MAE 0.89 ppm, H2O MAE 3937 ppm. T9 temperature: ridge MAE 9.4 K (MAPE 2.0%).

Full results on the leaderboard. Reproduce with baselines/README.md. Submissions: run python -m spektran.benchmark.evaluate on your predictions and open a PR.

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.5.0.tar.gz (15.0 MB view details)

Uploaded Source

Built Distribution

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

spektran-0.5.0-py3-none-any.whl (78.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spektran-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8121d1b23cdbf82a246c5ccb9ccc03008f8b9a46ce8fe08828296b9b70557572
MD5 03057864b242847eeb8c9b2674fae53c
BLAKE2b-256 1daa6f7d7224f7608039af977f63d693b48f624bef31e278e175d8d8b5de89fc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: spektran-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 78.7 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 366d5b5dafc32805feccdc5bc32b9146eda4165fcdd7eea9772cb02ba0fc4aee
MD5 94445e5eec094d4c356fffe6f7881dda
BLAKE2b-256 5324a6d378bb6bc4590200664b6d4e89e7d9a82db4302d0788c3aca650a6d1fc

See more details on using hashes here.

Provenance

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