Fit 2D time- and energy-resolved spectroscopy data
Project description
trspecfit - 2D Time- and Energy-resolved Spectroscopy Fitting
trspecfit is a Python package for modeling and fitting 1D energy-resolved and 2D time-and-energy-resolved spectroscopy data. It extends lmfit with composable spectral components, parameter-level time dynamics, convolution kernels, and simulation tools so you can build, fit, and validate physically meaningful models in one workflow.
Capabilities
- Modular components (Gaussian, Voigt/GLP/GLS, Doniach-Sunjic, backgrounds, kernels)
- 1D and 2D model construction with time-dependent parameters
- Global fitting via
lmfit, including CI and optional MCMC (lmfit.emcee) - Synthetic data generation (single spectra, 2D datasets, noisy realizations)
- Parameter-sweep simulation for validation and ML training data generation
Documentation
Full docs are hosted on Read the Docs:
- Docs home: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/
- Installation: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/installation.html
- Quick start: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/quickstart.html
- Examples: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/examples/index.html
- API reference: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/api/index.html
For consistent, central plot behavior, set plotting defaults at Project creation (typically via project.yaml), and see PlotConfig details and override patterns here: https://time-resolved-spectroscopy-fit.readthedocs.io/en/latest/api/plot_config.html
Installation
Install from PyPI:
pip install trspecfit
Install from GitHub:
pip install git+https://github.com/InfinityMonkeyAtWork/time-resolved-spectroscopy-fit.git
Quick Usage
from trspecfit import Project, File
project = Project(path='examples/simulator', name='local-test')
file = File(parent_project=project, path='simulated_dataset')
file.load_model('models_energy.yaml', ['ModelName'])
file.describe_model()
file.add_time_dependence(
model_yaml='models_time.yaml',
model_info=['TimeModelName'],
par_name='EnergyModelComponent_NN_par',
)
file.model_active.create_value2D()
value_2d = file.model_active.value2D
For full workflows, see the docs examples page and the notebooks in examples/.
Development
# Create env (same on all platforms)
python -m venv .venv
# Activate virtual environment
# Linux / macOS
source .venv/bin/activate
# OR Windows PowerShell
.\.venv\Scripts\Activate
# Install and setup (same on all platforms)
pip install -U pip
pip install -e ".[dev]"
python -m pre_commit install --install-hooks
# Commit changes (same on all platforms)
pytest
python -m pre_commit run --all-files
Repository Layout
src/trspecfit/- package sourcedocs/- Sphinx docs sourceexamples/- notebooks and YAML modelstests/- pytest test suite
Copyright Notice
time-resolved spectroscopy fit (trspecfit) Copyright (c) 2025, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.
NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trspecfit-0.4.0.tar.gz.
File metadata
- Download URL: trspecfit-0.4.0.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bbd9700baf1ba5bf1dc6467d74ef4b09630b63a2937ecb172f4ba5d8ef13cac
|
|
| MD5 |
de250d3c0f5a3d3855666343b4f29ec2
|
|
| BLAKE2b-256 |
eaa8b5b1fb5eedda43f139e6f5eaea3d6691c3fb50d8309a8b1a35f12ecc962f
|
Provenance
The following attestation bundles were made for trspecfit-0.4.0.tar.gz:
Publisher:
release.yaml on InfinityMonkeyAtWork/time-resolved-spectroscopy-fit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trspecfit-0.4.0.tar.gz -
Subject digest:
5bbd9700baf1ba5bf1dc6467d74ef4b09630b63a2937ecb172f4ba5d8ef13cac - Sigstore transparency entry: 962445792
- Sigstore integration time:
-
Permalink:
InfinityMonkeyAtWork/time-resolved-spectroscopy-fit@cc250944db586e36592139e074659e1ba6aaf38a -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/InfinityMonkeyAtWork
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@cc250944db586e36592139e074659e1ba6aaf38a -
Trigger Event:
push
-
Statement type:
File details
Details for the file trspecfit-0.4.0-py3-none-any.whl.
File metadata
- Download URL: trspecfit-0.4.0-py3-none-any.whl
- Upload date:
- Size: 109.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757fd9777855e05920875abc09174d6d761729843e8f3d5b71f90eaced6de857
|
|
| MD5 |
c60c2221e2cd4aa22e3e6f220eae6cb2
|
|
| BLAKE2b-256 |
b44fc8db65bf98783c14054a3811658b2a0225bf1f55519752ab27a3fba22e9c
|
Provenance
The following attestation bundles were made for trspecfit-0.4.0-py3-none-any.whl:
Publisher:
release.yaml on InfinityMonkeyAtWork/time-resolved-spectroscopy-fit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trspecfit-0.4.0-py3-none-any.whl -
Subject digest:
757fd9777855e05920875abc09174d6d761729843e8f3d5b71f90eaced6de857 - Sigstore transparency entry: 962445794
- Sigstore integration time:
-
Permalink:
InfinityMonkeyAtWork/time-resolved-spectroscopy-fit@cc250944db586e36592139e074659e1ba6aaf38a -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/InfinityMonkeyAtWork
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@cc250944db586e36592139e074659e1ba6aaf38a -
Trigger Event:
push
-
Statement type: