This repository contains a small utility script to quickly visualize which FLIM channels were active in a PicoQuant PTU file and to explore time-delay (dtime) windows. It produces:
- A log-scale histogram of the PTU counts summed over channels.
- A grid of images: rows = selected dtime windows, columns = detector channels.
Script: plot_ptu_channel_windows.py
- Load a PTU file via a
PtuFileinterface. - Compute simple, evenly spaced dtime windows (configurable count).
- Sum frames and dtime-bins into a 2D image for each channel and window.
- Save publication-ready PNGs.
- Python 3.9+ (tested versions may vary)
- numpy
- matplotlib
- ptufile (provides
PtuFilefor PTU file handling)
This script is based on PicoQuant and related PTU files, therefore it is necessary to install the following dependencies:
python -m pip install -U "ptufile[all]"Install all dependencies using pip:
pip install -r requirements.txtOr install them individually:
pip install numpy matplotlib ptufile- Place or reference your PTU file (e.g.,
FLIM_20250715-170852/RawImage.ptu). - Open
plot_ptu_channel_windows.pyand adjust:filename: path to the PTU file.N_WINDOWS: number of evenly spaced dtime windows.channel_ids: list of channel indices to visualize.
- Run the script:
python plot_ptu_channel_windows.pyptu_histogram_log.png: log-scale histogram of counts summed over channels.channels_overview_grid.png: grid of images with rows = windows and columns = channels.
- Windowing:
compute_windows_from_hist()currently splits the histogram range intoN_WINDOWSequal-width windows. You can replace this with peak-based window detection if desired. - Performance: The script decodes only the requested dtime window and integrates frames to keep memory usage manageable. Logging provides timing for decode and reduction steps.
- Import error for
ptufile: Ensure you've installed all dependencies withpip install -r requirements.txt. - No channels or unexpected shapes: The script logs
ptu.shape,frames,channels, andbinsto help verify file contents. - Large files: Reduce
N_WINDOWS, subsetchannel_ids, or run on a machine with more RAM.
Issues and pull requests are welcome. Please include a short description, steps to reproduce (if applicable), and environment details.
Specify your preferred license (e.g., MIT, Apache-2.0). If you want, I can add a LICENSE file for you.