Skip to content

SPEKTRAN

The MNIST of Gas Sensing — AI Agent Ready
Simulate, train, and evaluate optical gas sensing ML models via natural language

Try the Demo Install Leaderboard Agent Interface


What's Inside

  • 10 Molecules


    CH4, H2O, CO2, CO, NH3, NO, NO2, SO2, HCl, HF — HITRAN line-by-line physics with TIPS partition functions

  • Advanced Line Shapes


    Voigt profile and Hartmann-Tran Profile (HTP) with speed-dependent broadening, Dicke narrowing, and correlation

  • WMS Chain


    1f–4f lock-in demodulation, 2f/1f calibration-free ratio, etalon fringes in the time-domain chain

  • 46 Virtual Instruments


    Literature-anchored noise chains: laser chirp, etalon fringes, window contamination, beam wander, mirror drift, Ring effect

  • 5 Modalities


    TDLAS (DA + WMS), NDIR, CRDS (cavity ring-down), FTIR (Fourier transform), DOAS (differential optical)

  • 9 Benchmark Tasks


    Concentration regression, denoising, cross-instrument, WMS, drift, OOD, cross-modality, multi-species, temperature

  • AI Agent Ready


    Every CLI command outputs JSON. Discovery, training, and evaluation via natural language with any AI coding agent


Quick Start

from datasets import load_dataset
ds = load_dataset("spektran/spektran-ch4-v0")
pip install spektran
from spektran.physics import simulate_absorbance

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,
)
spektran generate configs/datasets/ch4-t1-train-v0.yaml --out data
spektran benchmark --task T1-concentration \
    --truth data/test.h5 --predictions preds.csv

Tell your AI coding agent (Claude Code, Cursor, etc.):

"Train the ridge baseline on T1 and show me the scores"

The agent reads AGENTS.md and runs:

spektran info --json                      # Bootstrap
spektran train --baseline ridge --json    # Auto-generates data + trains
# → {"scores": {"T1": {"mae_ppm": 2.84, "mape_pct": 29.87}}}

Key Results

The flagship finding

Model complexity correlates with instrument overfitting. Ridge degrades 1.31x, Transformer 1.46x, CNN 1.82x on held-out instruments — can you build a model that breaks this pattern?

Model T1 MAE (ppm) T3 Degradation
Ridge regression 2.84 1.31x
Patchified Transformer 7.39 1.46x
1D CNN 15.58 1.82x

View full leaderboard


GitHub Dataset
PyPI Pre-trained Baselines
Interactive Demo CITATION.cff