Skip to main content

Fit 2D time- and energy-resolved spectroscopy data

Project description

trspecfit - 2D Time- and Energy-resolved Spectroscopy Fitting

Documentation Status PyPI version

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
  • Auxiliary-axis parameter profiles via add_par_profile(...)
  • 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
  • Centralized plot configuration via PlotConfig with per-plot overrides

Documentation

Full docs are hosted on Read the Docs:

Support and Community

  • Questions and usage help: GitHub Discussions (Q&A category)
  • Ideas and brainstorming: GitHub Discussions (Ideas category)
  • Reproducible bugs and trackable feature requests: GitHub Issues
  • Maintainer response target: within 7 days

Links:

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='my_project', name='my_experiment')
file = File(parent_project=project, path='my_dataset')

# Load an energy model defined in a YAML file
file.load_model('models_energy.yaml', ['some_energy_model'])
file.describe_model()

# Fit each time slice individually
file.fit_SliceBySlice()

For global fits, dynamics, profiles, and advanced workflows see the Quick Start and Examples.

Development

# Create and activate virtual environment
# Linux / macOS
python3 -m venv .venv
source .venv/bin/activate
# OR Windows (PowerShell)
python -m venv .venv
.\.venv\Scripts\Activate

# [same commands for all platforms from here on]
# Install and setup
pip install -U pip
pip install -e ".[dev]"
python -m pre_commit install --install-hooks

# Commit changes
pytest
python -m pre_commit run --all-files

Repository Layout

  • src/trspecfit/ - package source
  • docs/ - Sphinx docs source
  • examples/ - notebooks and YAML models
  • tests/ - 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trspecfit-0.5.2.tar.gz (135.0 kB view details)

Uploaded Source

Built Distribution

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

trspecfit-0.5.2-py3-none-any.whl (117.2 kB view details)

Uploaded Python 3

File details

Details for the file trspecfit-0.5.2.tar.gz.

File metadata

  • Download URL: trspecfit-0.5.2.tar.gz
  • Upload date:
  • Size: 135.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trspecfit-0.5.2.tar.gz
Algorithm Hash digest
SHA256 b997c713c5c2aae65dcf460fd7bc3080ece370ad1cde34104b46d60fd98c2182
MD5 47d167bad5ff0955f6bb63f2e4ce7d76
BLAKE2b-256 eb47787028ea8282a80037dc890e4d3883a8d27b136441d8f8a1efe7f6ea7fe7

See more details on using hashes here.

Provenance

The following attestation bundles were made for trspecfit-0.5.2.tar.gz:

Publisher: release.yaml on InfinityMonkeyAtWork/time-resolved-spectroscopy-fit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trspecfit-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: trspecfit-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trspecfit-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a6e0853a228adb5b64471c9d4d8181d69e0b5094e078609e5bb202c5db281d9
MD5 589f0bbbf277e8e451bed82592acc8e0
BLAKE2b-256 ae24740b33369be567c3e44027ee196d8f7dc28df73645fb199e09ff4ada22d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for trspecfit-0.5.2-py3-none-any.whl:

Publisher: release.yaml on InfinityMonkeyAtWork/time-resolved-spectroscopy-fit

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