Skip to main content

TLDecPy core library for thermoluminescence glow-curve deconvolution.

Project description

TLDecPy: Thermoluminescence Glow-Curve Deconvolution in Python

License: BSD-3-Clause Python CI

tldecpy is an open-source scientific Python library for thermoluminescence (TL) glow-curve analysis, nonlinear deconvolution, and kinetic-model benchmarking.

The project is designed for reproducible research workflows in radiation dosimetry and TL materials analysis, with typed APIs and physically motivated models.

Supported Kinetic Models

TLDecPy includes single-peak and multi-peak deconvolution with:

  • First-order (FO): fo_rq, fo_ka, fo_wp, fo_rb
  • Second-order (SO): so_ks, so_la
  • General-order (GO): go_kg, go_rq, go_ge
  • One-Trap One-Recombination center (OTOR): otor_lw (Lambert W), otor_wo (Wright Omega)
  • Mixed-order families: mo_kitis, mo_quad, mo_vej
  • Continuous trap-distribution models (Gaussian and Exponential forms)

Highlights

  • Multi-component deconvolution with robust losses and optional Poisson weighting
  • Automatic initialization helpers (autoinit_multi, peak detection, preprocessing)
  • Uncertainty metrics and diagnostics in fit outputs
  • Synthetic data generation utilities for method validation
  • Bundled Refglow benchmark datasets (x001 to x010)
  • Typed models and results (py.typed, Pydantic v2 schemas)

Installation

From source

git clone https://github.com/HideOnParadise/TLDecPy.git
cd TLDecPy
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

Planned PyPI install

pip install tldecpy

Quickstart

import tldecpy as tl

# 1) Load a reference glow curve (Refglow)
T, I = tl.load_refglow("x001")

# 2) Automatic initialization of peaks and optional background
peaks, bg = tl.autoinit_multi(
    T,
    I,
    max_peaks=3,
    allow_models=("fo_rq", "go_kg", "otor_lw"),
    bg_mode="auto",
)

# 3) Run deconvolution
result = tl.fit_multi(
    T,
    I,
    peaks=peaks,
    bg=bg,
    beta=1.0,
    robust=tl.RobustOptions(loss="soft_l1", f_scale=2.0, weights="poisson"),
    options=tl.FitOptions(local_optimizer="trf"),
)

print("Converged:", result.converged)
print("R2:", f"{result.metrics.R2:.4f}", "FOM:", f"{result.metrics.FOM:.3f}%")
for peak in result.peaks:
    print(peak.name, peak.model, peak.params)

For an end-to-end OTOR demonstration, see:

  • examples/example_otor_fit.py
  • examples/example_refglow002_manual_fit.py (manual Refglow x002 deconvolution)

Development Quality Checks

make lint
make typecheck
make test
make qa

Citation

If TLDecPy contributes to your research, please cite the software archive (Zenodo DOI once released).

Suggested BibTeX entry:

@software{romero2026tldecpy,
  title   = {TLDecPy},
  author  = {Romero, Cesar},
  year    = {2026},
  url     = {https://github.com/HideOnParadise/TLDecPy},
  note    = {Zenodo DOI to be added after first release}
}

License

This project is distributed under the BSD 3-Clause License. See LICENSE.

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

tldecpy-1.0.0.tar.gz (81.6 kB view details)

Uploaded Source

Built Distribution

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

tldecpy-1.0.0-py3-none-any.whl (85.1 kB view details)

Uploaded Python 3

File details

Details for the file tldecpy-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for tldecpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 27a0e6b06a879f97cb160f6550e8ee0394a7057facec874f17ff8b009c431601
MD5 59ecbac45cf3bd57f00e34cfaf3a97f2
BLAKE2b-256 4d1c275c1e1db4489e27921a12ce710610542c21d5ec88431dcb5510dbecc541

See more details on using hashes here.

Provenance

The following attestation bundles were made for tldecpy-1.0.0.tar.gz:

Publisher: release-pypi.yml on HideOnParadise/TLDecPy

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

File details

Details for the file tldecpy-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for tldecpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdc03b8c631255655f60744a3554e36d50eece12aaff0d9e1764735b58585909
MD5 993edcc6cd1be55108bb04d475127338
BLAKE2b-256 280d83365d418966908734da7395160723f453dcace5971cd894e8fe4d40a4d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tldecpy-1.0.0-py3-none-any.whl:

Publisher: release-pypi.yml on HideOnParadise/TLDecPy

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