This package can be used to process raw *.tpx3 files output from a Timepix3 camera. It is meant for use in few-photon imaging with an intensified Timepix camera. These systems output raw files in a binary format, with a single photon detection being stored as a cluster of nearby pixel clicks. This package has functionality for parsing raw files, identifying clusters in an image based on spatiotemporal correlations, and analysis of the resulting data. In particular, it allows for photon positions to be calculated with arbitrary sub-pixel precision (whether this is useful is another question).
This code was written for use in a Timepix-based biphoton spectrometer, and so has analysis functions meant for this purpose, such as spectral calibration. Parsing and clustering functionality may be useful in more general contexts.
cupy-cuda12x
(requires a modern NVIDIA GPU)numpy
matplotlib
scipy
tqdm
from tpxpy.loader import TpxLoader, TpxImage
from tkinter.filedialog import askopenfilename
import matplotlib.pyplot as plt
fname = askopenfilename()
tpxl = TpxLoader()
# for best results, you should create a ToT calibration file, which is camera-specific. For example,
tpxl.generate_tot_calibration([fname,], 'tot_cal.txt') # can be generated from any .tpx3 image(s)
tpxl.set_tot_calibration('tot_cal.txt')
img = tpxl.load(fname)
hist2d = img.to_2d_image()
plt.imshow(hist2d)
plt.show()
If you encounter any errors, report them to the maintainer of the repository by email.
Related projects from our lab:
- PixGUI and tpx3_toolkit: A Python-based tool for ghost imaging, with more focus on spatial correlation analysis.
- Spectral HOM Analysis Tool: A C++-based GUI for batch processing of Timepix files.