Skip to main content

TDCR model

Project description

TDCRPy

TDCRPy Logo

A Photo-Physical Stochastic Model for Liquid Scintillation Counting

License Python Status BIPM


📖 Overview

TDCRPy is a Python package developed and maintained by the BIPM (Bureau International des Poids et Mesures). It estimates detection efficiencies of liquid scintillation counters using the TDCR (Triple to Double Coincidence Ratio) or CIEMAT/NIST methods.

The calculation is based on a photo-physical stochastic model, allowing users to address:

  • Complex decay schemes (Beta spectra via BetaShape).
  • Radionuclide mixtures.
  • Ionization quenching (Birks model).
  • Micelle effects in scintillator cocktails.
  • Dynamic efficiency evolution over time.

Technical details can be found in:


📦 Installation

TDCRPy requires a standard Python scientific environment.

1. Install Dependencies

You can install the required libraries via pip or conda.

# Using pip
pip install numpy scipy configparser tqdm importlib-resources

# Optional (for visualization and dynamic decay features)
pip install opencv-python radioactivedecay matplotlib

2. Install TDCRPy

pip install TDCRPy

To upgrade to the latest version:

pip install TDCRPy --upgrade

3. Run Tests

Verify the installation by running the unit tests:

python -m unittest tdcrpy.test.test_tdcrpy

⚡ Quick Start

Here is a basic example to estimate detection efficiencies for Co-60 using a symmetric PMT configuration.

import tdcrpy

# --- 1. Define Parameters ---
mode = "eff"           # Calculation mode
L = 1.2                # Free parameter in keV^-1
Rad = "Co-60"          # Radionuclide
pmf_1 = "1"            # Relative fraction (100%)
N = 1000               # Number of Monte Carlo trials
kB = 1.0e-5            # Birks constant in cm keV^-1
V = 10                 # Volume of scintillator in mL

# --- 2. Run Calculation ---
result = tdcrpy.TDCRPy.TDCRPy(L, Rad, pmf_1, N, kB, V, mode)

# --- 3. Display Results ---
print(f"Efficiency S (Single): {result[0]:.4f} +/- {result[1]:.4f}")
print(f"Efficiency D (Double): {result[2]:.4f} +/- {result[3]:.4f}")
print(f"Efficiency T (Triple): {result[4]:.4f} +/- {result[5]:.4f}")
print(f"Efficiency D (CIEMAT/NIST): {result[12]:.4f} +/- {result[13]:.4f}")

Calculate Free Parameter from Measured TDCR

If you have an experimental TDCR value ($R_T/R_D$), you can reverse-calculate the free parameter $L$:

TD = 0.9776  # Measured TDCR parameter
result = tdcrpy.TDCRPy.eff(TD, Rad, pmf_1, kB, V)

print(f"Global free parameter L = {result[0]:.4f} keV^-1")

🛠 Advanced Features

Asymmetric PMTs

TDCRPy supports calculations where the quantum efficiency differs between PMTs. Pass a tuple for the free parameter $L$:

# L for (PMT A, PMT B, PMT C)
L = (1.1, 1.3, 1.2) 
result = tdcrpy.TDCRPy.TDCRPy(L, "Co-60", "1", 1000, 1.0e-5, 10)

# Efficiencies for specific pairs (AB, BC, AC) are available in the result tuple
print(f"Efficiency AB: {result[6]:.4f}")

Radionuclide Mixtures

Simulate mixtures by providing comma-separated nuclides and their relative fractions.

# Example: 80% Co-60 and 20% H-3
Rad = "Co-60, H-3"
pmf_1 = "0.8, 0.2" 

result = tdcrpy.TDCRPy.TDCRPy(L, Rad, pmf_1, N, kB, V)

Dynamic Decay & Efficiency

Combine TDCRPy with radioactivedecay to simulate how efficiency changes as a sample decays (e.g., Mo-99/Tc-99m).

import radioactivedecay as rd
import tdcrpy as td
import numpy as np

# Define inventory
rad_t0 = rd.Inventory({'Mo-99': 1}, 'Bq')

# Decay for 30 hours
rad_t1 = rad_t0.decay(30.0, 'h')

# Calculate current composition for TDCRPy
A_t1 = rad_t1.activities('Bq')
total_activity = sum(A_t1.values())

# Format strings for TDCRPy
nuclides = ", ".join([k for k, v in A_t1.items() if v > 0])
fractions = ", ".join([str(v/total_activity) for k, v in A_t1.items() if v > 0])

# Run simulation
result = td.TDCRPy.TDCRPy(1.0, nuclides, fractions, 1000, 1e-5, 10, "eff")

⚙️ Configuration & Physics

You can customize the underlying physics model using tdcrpy.TDCR_model_lib.

To view current settings:

import tdcrpy as td
td.TDCR_model_lib.readParameters(disp=True)

Common Configurations

Parameter Method Description
Electron Bins modifynE_electron(n) Integration bins for electrons (default: 1000)
Alpha Bins modifynE_alpha(n) Integration bins for alpha particles (default: 1000)
Density modifyDensity(rho) Scintillator density in g/cm³ (default: 0.96)
Mean Z / A modifyZ(z), modifyA(a) Mean atomic/mass numbers of the cocktail
Micelle Effect modifyMicCorr(bool) Activate reverse micelle correction (default: False)
Micelle Size modifyDiam_micelle(d) Diameter in nm (default: 2.0)
Dead Time modifyDeadTime(t) Extended dead time in µs (default: 10)
Coincidence Time modifyTau(ns) Resolving time in ns (default: 50)

Tutorials


📚 Citations

If you use TDCRPy in your work, please cite the following:

TDCRPy: A python package for TDCR measurements > R. Coulon, J. Hu
Applied Radiation and Isotopes (2024)
DOI: 10.1016/j.apradiso.2024.111518


⚖️ License

This project is licensed under the MIT License.

Copyright © BIPM (Bureau International des Poids et Mesures).

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

tdcrpy-2.18.3.tar.gz (22.4 MB view details)

Uploaded Source

Built Distribution

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

tdcrpy-2.18.3-py3-none-any.whl (23.4 MB view details)

Uploaded Python 3

File details

Details for the file tdcrpy-2.18.3.tar.gz.

File metadata

  • Download URL: tdcrpy-2.18.3.tar.gz
  • Upload date:
  • Size: 22.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tdcrpy-2.18.3.tar.gz
Algorithm Hash digest
SHA256 babd47c3f1a1dc752dcaefd3d78b54a04bcc778693c7bf34eb50ae335c628260
MD5 69fe873f6a6c41ff3d6e8dbc3205f91b
BLAKE2b-256 8fbbaae3e5aa69685e38ebd99a1895098c6185a58f2bcd27b4527ec22cc00ca5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tdcrpy-2.18.3.tar.gz:

Publisher: python-publish.yml on RomainCoulon/TDCRPy

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

File details

Details for the file tdcrpy-2.18.3-py3-none-any.whl.

File metadata

  • Download URL: tdcrpy-2.18.3-py3-none-any.whl
  • Upload date:
  • Size: 23.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tdcrpy-2.18.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ea86ffbf94f8055fd19e7f60776053c2f36862aa7c05b61e592e9b46d4cd8f9a
MD5 c455c1b380b10a9f9953bf6bbf0564de
BLAKE2b-256 9ce0449b559a3c2cd71e59e994a5d4fc2516ad36fc86af9445e6a4778222fe64

See more details on using hashes here.

Provenance

The following attestation bundles were made for tdcrpy-2.18.3-py3-none-any.whl:

Publisher: python-publish.yml on RomainCoulon/TDCRPy

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