Doppler Estimation and Numerical Inference for Spectroscopy
A comprehensive tool for Collinear Laser Spectroscopy (CLS): run-time estimation, pre-analysis, SATLAS2-based fitting, and results visualization.
Version: 1.1.2 Developer: Arda Kayaalp ([email protected]) Framework: PySide6 (Qt6) + matplotlib + satlas2 + clstools
The recommended install path uses uv: it bootstraps Python itself, the project venv, and every dependency in one step. No existing Python install is required.
# Get the code git clone https://github.com/ardakayaalp/DENIS.git cd DENIS # First-time install (bootstraps uv, runs `uv sync`, creates a desktop # shortcut). No args = interactive menu; subcommands: full | uv | shortcut install.bat full # Windows ./install.sh full # Linux / macOS # Launch from the desktop shortcut, or from a terminal: uv run python gui.py # CLI estimation / load a save file on startup uv run python cls_estimate.py config.yaml --output-dir ./output uv run python gui.py my_config.yaml
If uv is already installed: uv sync && uv run python gui.py.
- Run-time estimation and HFS spectrum simulation in voltage space; isotope shift and resonance voltage calculations for multi-isotope plans
- Single-surface layout: global parameters, isotope list (color-striped), and Run Options + plots + log; an expand toggle covers the whole tab with the plots
- Runs persist (
estimate_results.npz+peaks.csvpercls_<timestamp>folder) and restore on load without re-running; Load Estimation... reopens any previous run, rendering PDF-only legacy runs onto the live canvas - Sortable Peak List view; intensity-ordered and voltage-ordered peak tables in the log
- Load and overlay ASDF runs with per-run color, opacity, and line style; TOF histogram with interactive gate and adjustable bin size (default 0.1 us, down to 1 ns); timestamp overview with per-scan exclusion
- Spectrum in voltage, frequency, or wavenumber, binned per scan step by default (immune to uniform-grid aliasing); a header Bin: N x step spin groups adjacent steps
- Layout switcher (3-row / 2-row), X/Y grid toggles, and a dark-mode plot toggle (black canvas, neon lines); default run colors from the classic Windows 98 palette, with separate light + dark colors per file and model
- HFS model overlay with sliders, ratio locks, per-peak Racah/Free/Linked amplitudes, and peak labels
- Spectrum merging in voltage or Doppler-shifted frequency domain; virtual file splitting (
.vasdf); per-file centroid offsets - Calibration and cooler-voltage diagnostics (robust statistics, spike detection, per-run summary table with a MHz-impact column)
- Voltage-calibration diagnostics and per-run overrides -- see below
- Block-based fitting pipeline: Source -> Model -> Fitter -> Output
- Models: HFS (sidepeaks, Racah), Voigt, Skewed Voigt, Exponential Decay, Piecewise Constant, Polynomial; HFS, Voigt and Skewed Voigt carry a polynomial background of any order. Methods: leastsq, least_squares, slsqp, emcee (MCMC), nelder, powell, cobyla. Statistics: Chi-square, Gaussian LLH, Poisson LLH
- A ? guide beside Method & Statistics explains which to use when. A likelihood is never minimised with leastsq (satlas2 would silently switch to SLSQP; DENIS runs nelder and says so), and the sqrt(2) inflation of numerical likelihood error bars can be corrected (opt-in, reported)
- Separate (per-file, parallel) and simultaneous fitting; opt-in parameter sharing, expression constraints with live validation, Gaussian priors
- MCMC diagnostics: walk plots with the burn-in cut marked, corner plots with filled 2-D credible regions (0.5/1/1.5/2 sigma) and a choice of colour scale, confidence bands, chi-square maps. Burn-in applies to everything (values, errors, correlations, corner plot, band, plotted fit), and emcee / likelihood fits report statistics recomputed from the residuals
- Binning as first-class controls:
Per scan step(default),Auto,Fixed bin count,Fixed bin width; aBin multiplespin groups adjacent steps; per-file binning overrides via right-click; optional common-grid re-binning for simultaneous fits - A three-tab Binning dialog (Summary occupancy table, Run detail with bin edges + a measured 1 V ~ N MHz scale strip + aliasing warnings, Compare heatmap); binning warnings land in the fit report and
binning_summary.csv - Multi-start parallel Auto-Fitter to seed initial guesses, using the Fitter block's own method and statistics; Update iteration regenerates outputs into the existing iteration without re-fitting (walk/correlation rebuilt from saved chains)
- Isotope Shifts tab: weighted averages with Birge inflation, systematic errors from cooler/laser jitter, a full per-shift error budget, and a run preview panel. A Reference Project is listed automatically and marked as the shift reference
- Reference Centroid Correction (GP): time-dependent drift correction following van den Borne (2025), in its own tab. Fit reference scans in a Reference Project, train a GP (RBF / Matern(5/2) / composite kernel via PyMC v5), exclude individual reference runs, and apply per-run corrections consistently in fits, merges, and the Auto-Fitter; correlated corrections partially cancel in shifts via the GP cross-covariance. A two-panel GP figure and a Centroids diagnostic show the drift and each run's corrected centroid
- Cooler-voltage calibration: 171Yb+/173Yb+ calibration projects fitted over a grid of assumed cooler offsets; each isotope's hyperfine A(dV) line meets its literature value at a zero crossing, and the crossing of the two isotope lines gives the offset. The common offset applied to all runs can instead be the middle or the weighted mean of the two zero crossings, or a manual value; the zero crossings (optionally widened by their 1 sigma) bound the systematic range. The offset rides on each event's cooler readback, and iterations carry it in their name (
iter_001_-30V_CO) - Systematics tab: refits the whole chain (reference fit, GP retraining, per-file corrections, sample fits, isotope shifts) at several cooler offsets, seeding each step from its neighbours. By default every run is fitted three times: at the common offset (the quoted values) and at the two zero crossings (the systematic is the larger edge deviation; both signed deviations are listed); an even grid across the range is also available. The band per parameter uses the definition you choose (half/full width, std, max or RMS deviation, max deviation / sqrt(3)); a Budget tab adds further systematics per project, run or parameter, combined in quadrature or as a linear sum, with optional Birge scaling of run averages; flagged steps can be re-run with edited seeds; results go to the Results tab
- A project can be converted between sample, reference, and cooler-calibration from its tab's right-click menu
- On-plot fit-values box, shade-under-fit, and per-plot-type styling via the Output block's Plot Options... dialog
- Browse everything by project and iteration (fresh results marked NEW); live re-rendering of fit, tracker, and diagnostic plots from their
.npzdata - Plot edits persist in
.style.jsonsidecars; copy/paste plot style between plots with a property checklist (bulk paste supported) - Export data as CSV (data, errors, model, residuals, fit curve) with column/delimiter/precision control; export single items or whole iterations
- CSV viewer shaded by run, sortable and filterable; fit reports syntax-highlighted
- Project and iteration notes with autosave; on load, exactly the saved iterations are restored (Refresh All re-scans the directory)
- Schmidt Moment Calculator (single- and two-particle), Shell Configuration Plotter (spherical shell model, Nordheim rule), Unit Converter (nm, cm^-1, MHz, GHz, THz, eV), SHG Crystal Angle Calculator (Type I, BBO/KDP/LBO), SFG / DFG Calculator (mixed-unit inputs), Quick Plot (CSV/TSV or pasted data)
- ASDF Viewer: inspect raw run files -- drop them on the window or right-click a run in Pre-Analysis or a Source block. Header entries as stored, the event table with named columns and per-column statistics, the full ASDF tree; hover a column for its meaning and unit. Large drops load on worker processes
- NIST ASD Browser: in-app NIST Atomic Spectra Database browser + multi-step excitation scheme finder -- level/line tables and diagrams (lifetime-encoded opacity), air/vacuum toggle, offline cache, ranked 1-3-step scheme search with laser roles, branching-ratio and isobar-contamination checks, CSV export, save-file persistence
- Two themes: default dark and Classic 98 (dark), applied live; Lucide icons; splash screen
- Editor-style save model with dirty tracking (Save / Save As / Save Tab As; clean sessions close silently); New Window opens an independent instance
- Plot editor everywhere: right-click any canvas -> Edit plot... -- six tabs with real font pickers, add/remove annotations and lines, per-artist position/rotation/z-order, log scales, and its own Ctrl+Z/Ctrl+Y undo
- App-wide spinbox undo/redo and Ctrl+C/Ctrl+V; wheel-focus guard (scrolling never edits an unfocused field); zoom (Ctrl+= / Ctrl+- / Ctrl+0)
- Settings in
settings/settings.yaml: theme, plot defaults (global + per-plot-type), UI scale, path auto-conversion, output/fitting defaults - Session log always written to
logs/denis_<timestamp>.log(newest 20 kept, crash hook included, native crashes traced); a Verbose toggle raises it to DEBUG - Loading a session shows its progress; tooltips appear as compact boxes by the pointer
- Data moved since the session was saved: a missing-files dialog searches the session's folder (and any folder you pick, with or without subfolders) for every missing run at once, and one located file resolves a whole moved folder; runs still missing are never removed from the session file
Pinned in pyproject.toml + uv.lock and resolved automatically by uv sync. For reference:
- Python 3.10+ (downloaded by
uvif not present) - PySide6 -- Qt6 GUI framework
- matplotlib, numpy, pandas -- plotting and numerics
- satlas2 -- hyperfine structure fitting (locked at 0.1.10; brings numdifftools, which lmfit uses for the error bars of scalar minimisers)
- clstools -- CLS data loading; not on PyPI, pulled from github.com/andry3vi/cls_tools via
[tool.uv.sources], pinned tof6b9d7. DENIS overwritesdata.Calafter everyLoad_Run(see Voltage calibration), so results do not depend on the pinned version - PyYAML, asdf, lmfit, emcee, h5py (MCMC chains), periodictable, tabulate
- pymc -- PyMC v5, required only by the GP reference-centroid correction
DENIS/
|-- gui.py # GUI entry point
|-- cls_estimate.py # CLI entry point
|-- pyproject.toml, uv.lock # uv project + pinned dependencies
|-- install.bat, install.sh # installers (full | uv | shortcut)
|-- icons/ # app icon, logo, Lucide icons (MIT)
|-- cls_estimations/ # core computation library (Doppler, HFS,
| # Schmidt, isotope shifts, GP corrector,
| # cooler calibration, systematics, ASDF
| # reader, IUPAC/AME mass table)
|-- gui/ # PySide6 modules: main window + themes,
| |-- analysis/ # the four tabs, calibration machinery,
| |-- manual/ # in-app manual (Help > Documentation),
| |-- nist_asd/ # NIST ASD Browser
|-- settings/ # user settings + pre-seeded NIST cache
|-- configs/ # example YAML configurations
|-- docs/manual/ # LaTeX manual (manual.pdf pre-built)
|-- tests/ # headless pytest suite (offscreen Qt)
The toolkit reads ASDF files produced by the IGISOL CLS DAQ system: raw event data (timestamp, scanning voltage, bunch, PMT channel, TOF, cooler voltage), calibration tables (set/readback pairs), and run metadata.
Processing pipeline: Load_Run -> apply calibration -> Compute_Voltages -> Compute_WL -> Compute_Bins (via clstools)
Each run carries a DAC->HV calibration table; a polynomial through it turns every event's DAC value into a real voltage, so a bad table biases the whole frequency axis. At 30 kV, 1 V of calibration error is typically tens of MHz of centroid shift, and an offset+gain error tilts the axis rather than translating it.
DENIS owns the calibration fit (gui/calibration.py): every load path overwrites data.Cal before Compute_Voltages, so the numbers do not depend on the installed clstools build, and by default nothing is dropped (upstream clstools silently applies a 2-sigma cut; DENIS turns it off and makes rejection an explicit, recorded choice).
- Runs whose calibration outliers would actually move their centroid get a blinking
!badge (Pre-Analysis and Analysis); clicking it reports the cost in MHz and the acknowledgement is saved with the project - Right-click a run -> Calibration...: fit-vs-file overlay, residuals before/after, cost in MHz, point exclusion (click, drop-first-N, or iterative n-sigma), a zero-intercept (p0 = 0) option, borrowing another run's calibration, or manual coefficients. Points are coloured by acquisition order, hovering one reads it out in V and MHz, the table and plot select together, and the plot has a dark mode
- Calibration overview... triages every loaded run at once, worst first
- Overrides are per-file, shared across tabs, and persist under the save file's top-level
calibrations:key; every drop is recorded in the fit report
Reproducing old filtered results bit-for-bit: in the flagged runs' Calibration... dialog set Drop points to Drop residual outliers (n-sigma), Cut at 2, with iterative unticked.
- In-app manual: Help > Documentation (F1) -- an interactive, cross-linked reference covering every tab, tool, and file format
- PDF manual:
docs/manual/manual.pdf(LaTeX sources alongside; rebuild withbuild.bat/build.sh)
DENIS is released under the MIT License. Releases are archived on Zenodo: cite v1.1.2 via 10.5281/zenodo.23498633 (v1.1.1: 10.5281/zenodo.23497223; v1.1.0: 10.5281/zenodo.22994563; v1.0.0: 10.5281/zenodo.22081267), or all versions via the concept DOI 10.5281/zenodo.22081266 (also in CITATION.cff, surfaced as GitHub's Cite this repository button). Please also cite satlas2, clstools, and the CIAAW/AME mass table for the underlying methods and data.
- satlas2: iks-nm.github.io/satlas2 -- W. Gins et al., KU Leuven
- clstools: github.com/andry3vi/cls_tools -- A. Raggio, JYFL
- IUPAC masses: ciaaw.org -- CIAAW/AME recommended nuclide masses (2021)
- Lucide icons: lucide.dev -- MIT/ISC license