trspecfit examples#
trspecfit fits multi-component spectral models to 1D energy-resolved and 2D time- and energy-resolved spectroscopy data: modular lineshapes, time dynamics, convolution kernels, parameter profiles, and lmfit-based fitting with confidence intervals and MCMC.
The pages here are the package’s example notebooks, executed end to end, so you can read the plots, fit reports and tables without installing anything. They were run with trspecfit 0.20.0 (git ref v0.20.0) on 2026-10-03. Every page has a download button for the executed notebook.
To run them yourself:
python -m pip install "trspecfit[lab]"
Source on GitHub · Documentation · PyPI
Pick the notebook that matches what you are trying to do; each one is self-contained. The fitting workflows are numbered in blocks: 0x single-file fitting skills, 1x post-fit work, 2x multi-file workflows.
Fitting workflows#
Notebook |
What you learn |
|---|---|
Load data, define a model, fit baseline + 2D, visualize results. |
|
Link parameters with expressions and physical constraints. |
|
Multi-cycle dynamics with subcycles and frequency. |
|
Depth-dependent parameters via profile functions (with optional time-dependence). |
|
Compare two models on the same file (baseline / SbS / 2D). |
|
|
|
Declare the noise model, then three tiers of parameter uncertainty — |
|
What the |
|
Multi-file workspace, per-file independent fits (bridge to shared-parameter fitting). |
|
Multi-file workspace, shared-parameter fits across files. |
Synthetic data#
Notebook |
What you learn |
|---|---|
Generate synthetic noisy data from a known ground truth. |
|
Sweep parameter space for ML training datasets. |
Data generators#
Some examples ship synthetic data made by a notebook in their data/ directory from truth model files, which those pages show. The build re-runs the generators and checks that the regenerated data matches what the examples were fitted to.