Skip to main content

Ultrafast spectroscopy fitting toolkit

Project description

Ultrafast-Fit: CLI-Based Spectroscopy Fitting Tool

Ultrafast-Fit is a command-line tool for analyzing ultrafast spectroscopy data. It supports robust model fitting, automatic exponential component estimation, batch fitting, and various visualizations for both 1D and 2D data formats.

🚀 Installation

pip install ultrafast-fit

For editable local development:

pip install -e .

📁 Input Format

  • 1D Data: CSV with two columns: time and signal
  • 2D Data: CSV with time as rows, wavelengths as columns

📦 CLI Usage

ultrafast-fit --data-file <path> [options]

Required

  • --data-file <file>: Path to input .csv, .txt, .xlsx, or .mat file

Optional Arguments

  • --n-components <int>: Specify number of exponential components manually
  • --max-components <int>: Max number of components to test for best AIC model [Default: 4]
  • --show-plots: Show all fit plots interactively
  • --export-summary: Export CSV summaries of fits
  • --plot-aic: Plot AIC vs. number of components (for 1D data)
  • --save-extra: Save extra visualizations like heatmaps and average fit (2D only)
  • --show-every <int>: Show every N-th plot during 2D batch fitting [Default: 10]
  • --heatmap: Create model comparison heatmap (2D only)
  • --global-fit: Perform global fitting across all wavelengths (shared lifetimes, 2D only)
  • --thermo: Run thermodynamic analysis to estimate activation energies (2D only)

✅ Example Commands

1D Fit (Single Trace)

ultrafast-fit --data-file sample_data.csv --n-components 3 --show-plots --export-summary

2D Batch Fitting with Heatmap + Thermo

ultrafast-fit --data-file synthetic_2d_data.csv \
  --n-components 4 \
  --show-plots \
  --export-summary \
  --save-extra \
  --heatmap \
  --thermo \
  --show-every 25

📊 Output

  • results/<timestamp>/
    • best_fit_signal.csv, residuals.csv, batch_fit_summary.csv
    • best_fit_only.png, aic_vs_components.png
    • Extra: residual_heatmap.png, average_dynamic_fit.png, model_comparison_heatmap.png

📌 Notes

  • The --thermo flag performs Arrhenius-style activation energy estimation using effective rate constants across wavelengths.
  • --global-fit enables multi-wavelength fitting with shared exponential lifetimes, useful for spectral consistency.

👨‍🔬 Author

Created by Alan Arana © 2025.


📤 PyPI Upload

To publish to TestPyPI:

python3 -m build
python3 -m twine upload --repository testpypi dist/*

To install from TestPyPI:

pip install -i https://test.pypi.org/simple/ ultrafast-fit

To publish to PyPI:

python3 -m twine upload dist/*

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

ultrafast_fit-1.9.8.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

ultrafast_fit-1.9.8-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file ultrafast_fit-1.9.8.tar.gz.

File metadata

  • Download URL: ultrafast_fit-1.9.8.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ultrafast_fit-1.9.8.tar.gz
Algorithm Hash digest
SHA256 91e927706f980cff1d337b3992175c44ca03276e778e4d5c78921b2df8d77360
MD5 ddc3261654a7d9d5f171dd5872c205c6
BLAKE2b-256 26c92f26d48f44685aeb4bb76a7373525f5d4f4aa4e64eac1b1899bf5b4a670a

See more details on using hashes here.

File details

Details for the file ultrafast_fit-1.9.8-py3-none-any.whl.

File metadata

  • Download URL: ultrafast_fit-1.9.8-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ultrafast_fit-1.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ab9a153a4f073b3c9d1373f480c5dcf4d6f80a8b9c526d0ba27dfe042608b56a
MD5 6f0bfc748602fd6af7b67166ff8385a1
BLAKE2b-256 dd8af510791a410233cd33ad106bf25e7d3600af76452f5795d1b527b92d15c9

See more details on using hashes here.

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