Skip to main content

scintiPulses

scintiPulses Logo

Realistic Simulation of Scintillation Detector Signals

License Python Status BIPM


📖 Overview

scintiPulses is a Python package designed to generate high-fidelity photodetector signals from scintillation detectors. It models the complete signal chain—from the initial energy deposition to the final digitized output—incorporating key photochemical processes, electronic effects, and digitization artifacts.

This tool is ideal for post-processing data from Monte Carlo simulation frameworks (e.g., Geant4, MCNP, FLUKA), transforming raw energy deposition timestamps into realistic pulse waveforms for algorithm testing and detector design.


✨ Key Features

  • Physics-Based Modeling: Simulates time-dependent fluorescence including prompt and delayed components, with Fano factor support.
  • Ionisation Quenching: Optional Birks-law quenching of the prompt yield, driven by an electron stopping-power model (Bethe + Joy-Luo).
  • Delayed (TTA) Fluorescence: independently selectable yield model (triplet-triplet annihilation reservoir $\Psi(E)$, independent of Birks quenching, or a fixed fraction of the prompt yield) and kinetics model (diffusion-controlled King–Voltz law decaying as $t^{-3/2}$, or plain exponential), so any combination can be paired. See docs/photophysics_model.md for the full derivation.
  • Multi-Channel Support: Simulate signals across multiple independent detector channels.
  • Photodetector Physics: Incorporates quantum shot noise, after-pulses, and thermionic (dark) noise.
  • PMT Modeling: Configurable gain, gain fluctuation, signal inversion, and charge spreading.
  • Electronic Simulation: Models Johnson-Nyquist thermal noise and signal shaping.
  • Analog Filtering: Simulates charge-sensitive preamplifiers and CR$^{n}$ fast shapers.
  • Digitization: Includes anti-aliasing low-pass filtering, ADC quantization, and saturation effects.

Technical details and validation can be found in:

DOI: https://doi.org/10.1051/epjconf/202533810001


📦 Installation

You can install scintiPulses directly via pip:

pip install scintiPulses

🖥️ Graphical Interface

scintiPulses ships with an interactive interface that runs in your web browser. You can use it to configure, run and explore simulations without writing code.

pip install "scintiPulses[gui]"   # adds streamlit, plotly and pillow
scintipulses-gui                  # or: python -m scintipulses.gui

From a source checkout, you can also run streamlit run scintipulses/app.py.

  • Presets to get started in one click: single pulse, Poisson pulse train, three-PMT coincidence (TDCR-like), shaped pulse, and the legacy double-exponential model.
  • Guided parameters, grouped by stage of the detector chain (source, scintillator, photodetector, analog electronics, digitizer) and shown in convenient units (ns, µs, pF, MHz). Each one has a tooltip, and the parameters of inactive effects are greyed out.
  • Energy sources: fixed values, Gaussian or uniform distributions, or a spectrum file (one energy in keV per line, e.g. from Geant4/MCNP/FLUKA).
  • Input validation and a run-time estimate before you launch. Short simulations re-run automatically as you edit (Live update).
  • Interactive waveforms: overlay any stages (v0 to v8), view the whole chain as small multiples, inspect individual events, and switch between channels.
  • Light model explorer: instant analytic preview of the prompt and delayed emission, Birks quenching and TTA reservoir yield curves.
  • Reproducible exports: a stand-alone Python script that reproduces the run exactly (fixed seed), a JSON configuration you can reload later, and the waveforms as NPZ or CSV.

🚀 Quick Start

The following example simulates a single 10 keV energy deposition with a fixed arrival time, using a fast scintillator (e.g. LSO/LYSO-like), and plots the transimpedance amplifier output of the PMT.

import scintiPulses as sp
import matplotlib.pyplot as plt

t, v0, v1, v2, v3, v4, v5, v6, v7, v8, y0, y1 = sp.scintiPulses(
    # Source parameters
    [10],               # Energy deposition(s) in keV
    tN=1e-6,            # Total simulation duration (s)
    arrival_times=[1e-9],  # Fixed arrival time; if False, times are drawn from Poisson process
    lambda_=1e4,        # Input count rate (s⁻¹), used when arrival_times=False
    fS=1e9,             # Sampling frequency (Hz)
    # Scintillation parameters
    nChannel=1,         # Number of detector channels
    tau1=4.6e-9,        # Prompt fluorescence decay time (s)
    tau2=120e-9,        # Delayed decay time, or King-Voltz reference time (s)
    quenching=False,    # Enable Birks ionisation quenching of the prompt yield
    kB=0.008,           # Birks constant (cm/MeV), used if quenching=True
    TTA_yield=False,    # Fixed delayed fraction p2 (True: delayed yield L*eta*Psi(E) from the TTA reservoir)
    TTA_kinetics=False, # Exponential delayed component (True: King-Voltz law, decays as t^-3/2)
    eta=0.1,            # Delayed amplitude (fraction of the reservoir Psi), used if TTA_yield=True
    Sa=0,               # Saturation stopping power (keV/cm); 0 gives Psi(E)=E, used if TTA_yield=True
    p2=0.1,             # Delayed fraction of the prompt yield, used only if TTA_yield=False
    nE=100,             # Discretization points for the quenching/TTA reservoir integrals
    F=1,                # Fano factor of the scintillator
    L=5.11,             # Light yield (photons/keV)
    # PMT parameters
    C=5e-12,            # PMT capacitance (F)
    G0=20e6,            # PMT gain
    sigma_G=0,          # PMT gain fluctuation (relative std dev)
    I=-1,               # Voltage inverter (+1 or -1)
    tauS=2.23e-9,       # Charge spreading time (s)
    afterPulses=False,  # Enable after-pulses
    pA=1e-3,            # After-pulse probability
    tauA=5e-6,          # Mean after-pulse delay (s)
    sigmaA=1e-6,        # Std dev of after-pulse delay (s)
    darkNoise=False,    # Enable thermionic dark noise
    fD=1e-4,            # Dark count rate (s⁻¹)
    # Analog electronics
    electronicNoise=False,  # Enable Johnson-Nyquist noise
    sigmaRMS=0.01,      # Electronic noise RMS (V)
    pream=False,        # Enable charge-sensitive preamplifier
    G1=1,               # Preamplifier charge gain C/Cf
    tauRC=0.5e-6,       # Preamplifier feedback decay time Rf*Cf (s)
    ampli=False,        # Enable fast amplifier (shaper)
    G2=1,               # Amplifier gain
    tauCR=2e-6,         # Amplifier CR time constant (s)
    nCR=1,              # Order of the CR filter
    # Digitization
    digitization=False, # Enable ADC simulation
    fc=0.4e9,           # Anti-aliasing filter cut-off frequency (Hz)
    R=10,               # ADC resolution (bits)
    Vs=0.5,             # ADC voltage range (V)
)

# Plot the PMT transimpedance output (v4)
plt.figure(figsize=(8, 3))
plt.plot(t, v4, "-", alpha=0.7, label="Transimpedance output")
plt.xlabel(r"$t$ /s")
plt.ylabel(r"$v$ /V")
plt.title("Simulated Scintillation Pulse")
plt.legend(loc="upper right")
plt.grid(True)
plt.tight_layout()
plt.show()

📡 The Signal Chain (Outputs)

The function returns a 12-element tuple. This allows inspection of the signal at every stage of the processing chain.

Variable Unit Stage Description
t s Time base vector.
v0 $e^-$ Idealized scintillation signal (charge).
v1 $e^-$ Shot Noise: Quantized photons added.
v2 $e^-$ After-pulses: Spurious pulses added (if enabled).
v3 $e^-$ Dark Noise: Thermionic noise added (if enabled).
v4 V PMT Output: Anode voltage, a Gaussian pulse of peak $G_0 e/C$ per photoelectron.
v5 V Thermal Noise: Electronic white noise added (if enabled).
v6 V Preamplifier: Charge-sensitive preamplifier output, integrated anode charge (if enabled).
v7 V Shaper: Post-CR$^n$ fast amplifier signal (if enabled).
v8 V ADC: Final output after filtering, quantization & saturation (if enabled).
y0 — Auxiliary output (channel-level intermediate).
y1 — Auxiliary output (channel-level intermediate).

⚙️ Configuration Parameters

The default values describe an experimentally calibrated TDCR liquid scintillation counter: Hamamatsu R331-05 photomultipliers (gain $G_0 = 20\cdot10^6$ on $C = 5$ pF, i.e. a single-photoelectron pulse of peak $G_0 e/C = 0.64$ V and standard deviation $\tau_S = 2.23$ ns, quantum efficiency 0.25), a CAEN DT5751 digitizer (1 GS/s, 10 bits, ±0.5 V), and a ⁵⁵Fe source in Ultima Gold described by a double-exponential light pulse ($\tau_1 = 4.6$ ns, $\tau_2 = 120$ ns, delayed fraction $p_2 = 0.10$, light yield $L = 5.11$ keV⁻¹). For toluene-based cocktails, $\tau_1 \approx 3.6$ ns and $L \approx 8$ keV⁻¹ are typical.

1. Source & Timing

Parameter Type Default Description
Y array None Energy deposition samples (keV).
arrival_times array / bool False Explicit particle arrival times (s). If False, times are drawn from a Poisson process at rate lambda_.
tN float 1e-4 Total simulation duration (s).
lambda_ float 1e4 Input count rate for random arrivals (s$^{-1}$).
fS float 1e9 Sampling frequency (Hz).

2. Physics & Scintillation

Parameter Type Default Description
nChannel int 1 Number of detector channels.
tau1 float 4.6e-9 Decay constant for the prompt component (s).
tau2 float 120e-9 Characteristic time of the delayed component (s): decay time of a plain exponential if TTA_kinetics=False, or reference time $\tau_d$ of the King–Voltz law if TTA_kinetics=True.
F float 1 Fano factor of the scintillator.
L float 5.11 Scintillation light yield (photons/keV).
quenching bool False Enable Birks ionisation quenching (Sn→S1 internal conversion) of the prompt yield only. See kB. The TTA reservoir $\Psi$ does not depend on kB.
kB float 0.008 Birks constant (cm/MeV), used only if quenching=True.
TTA_yield bool False Delayed-yield model selector. If True, the mean number of delayed photons is $L,\eta,\Psi(E)$ with the triplet-triplet-annihilation reservoir $\Psi(E)=\int_0^E \varphi_{TTA}(S/S_a),dE'$, $\varphi_{TTA}(\beta)=1-\ln(1+\beta)/\beta$; if False, use a fixed fraction p2 of the prompt yield. Independent of TTA_kinetics.
TTA_kinetics bool False Delayed-time-shape model selector. If True, use the King–Voltz arrival law of diffusion-controlled delayed fluorescence, emission $\propto (1+t/\tau_2)^{-3/2}$ and capture fraction $1-(1+t/\tau_2)^{-1/2}$; if False, use a plain exponential (decay time tau2). Independent of TTA_yield, so any combination is valid.
eta float 0.1 Delayed-fluorescence amplitude, as a fraction of the reservoir $\Psi$, used only if TTA_yield=True.
Sa float 0 Saturation stopping power of $\varphi_{TTA}$ (keV/cm), used only if TTA_yield=True. 0 gives the linear reservoir $\Psi(E)=E$; about 1667 keV/cm is literature-typical.
p2 float 0.1 Delayed fluorescence emitted in addition to the prompt light, as a fraction of the prompt yield ($0 \le p2 \le 1$), used only if TTA_yield=False.
nE int 100 Number of points used to discretize the Birks (quenching) and TTA reservoir integrals.

See docs/photophysics_model.md for the full mathematical model, including the electron stopping-power model and the discrete-time hazard functions used for the stochastic photon simulation.

3. Photodetector (PMT)

Parameter Type Default Description
C float 5e-12 PMT capacitance (F).
G0 float 20e6 PMT gain. A single photoelectron gives a Gaussian pulse of peak $G_0 e/C$ (0.64 V by default).
sigma_G float 0 Relative standard deviation of the PMT gain (fraction of G0).
I float −1 Voltage inverter factor (+1 or −1).
tauS float 2.23e-9 Standard deviation of the Gaussian single-photoelectron pulse (s).
darkNoise bool False Enable thermionic dark noise.
fD float 1e-4 Dark noise count rate (s$^{-1}$).
afterPulses bool False Enable after-pulses.
pA float 1e-3 Probability of an after-pulse.
tauA float 5e-6 Mean after-pulse delay (s).
sigmaA float 1e-6 Standard deviation of after-pulse delay (s).

4. Analog Electronics

Parameter Type Default Description
electronicNoise bool False Enable Johnson-Nyquist noise.
sigmaRMS float 0.01 RMS value of electronic noise added to the anode signal (V).
pream bool False Enable the charge-sensitive preamplifier: the anode charge is integrated and decays with tauRC, so each photoelectron gives a step of G1*G0*e/C.
G1 float 1 Preamplifier charge gain $C/C_f$.
tauRC float 0.5e-6 Preamplifier feedback decay time $R_f C_f$ (s).
ampli bool False Enable fast amplifier (shaper).
G2 float 1 Fast amplifier gain.
tauCR float 2e-6 Fast amplifier CR time constant (s).
nCR int 1 Order of the CR filter.

5. Digitization (ADC)

Parameter Type Default Description
digitization bool False Enable ADC simulation stage.
fc float 4e8 Anti-aliasing filter cut-off frequency (Hz).
R int 10 ADC resolution (bits).
Vs float 0.5 Dynamic range / saturation voltage (±V).

📚 Citations

If you use scintiPulses in your research, please cite:

Simulation of scintillation detector signals EPJ Web of Conferences (2025) DOI: 10.1051/epjconf/202533810001

You can also look at:

Simulation of stochastic jittering in liquid scintillation counters RAD Conference - abstract (2026) DOI: 10.21175/rad.abstr.book.2026.28.5


⚖ License

This project is licensed under the MIT License.

Metadata

Release files for scintiPulses 4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scintiPulses 4.0
File Size Uploaded Provenance Actions
scintipulses-4.0.tar.gz 73.5 kB With provenance Details for scintipulses-4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scintiPulses 4.0
File Interpreter ABI Platform Actions
scintipulses-4.0-py3-none-any.whl Python 3 none any Details for scintipulses-4.0-py3-none-any.whl

Total release size: 147.1 kB

Release files / scintipulses-4.0.tar.gz

Download URL scintipulses-4.0.tar.gz
Size 73.5 kB
Tags Source
SHA-256 checksum
How to use checksums
da8897c981427b1ced71ba55ef3b6add051d488a33cba12c5743f847d15ea6d5
BLAKE2b-256 checksum
How to use checksums
e7a2345c7ffd1997790c6a44dcaa8fe84d896cb30c83aa8a3ba2ea56da977752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / scintipulses-4.0-py3-none-any.whl

Download URL scintipulses-4.0-py3-none-any.whl
Size 73.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d23d0686ab3d721eea75a1980806e87973e51bf276134e2fdb8c79befe0a5af8
BLAKE2b-256 checksum
How to use checksums
c535d6618c6c9260985d42482bd2b82b5b9591a48389842abe79ed4d4fa99bda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for scintiPulses 4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scintipulses-4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page