Read PicoQuant PTU and related files
Project description
Ptufile is a Python library to read image and metadata from PicoQuant PTU and related files: PHU, PCK, PCO, PFS, PUS, and PQRES. PTU files contain time correlated single photon counting (TCSPC) measurement data and instrumentation parameters.
PicoQuant GmbH is a manufacturer of photonic components and instruments.
- Author:
- License:
BSD 3-Clause
- Version:
2023.11.1
Quickstart
Install the ptufile package and all dependencies from the Python Package Index:
python -m pip install -U ptufile[all]
See Examples for using the programming interface.
Source code and support are available on GitHub.
Requirements
This revision was tested with the following requirements and dependencies (other versions may work):
CPython 3.9.13, 3.10.11, 3.11.6, 3.12.0 (64-bit)
Numpy 1.25.2
Xarray 2023.10.1 (recommended)
Matplotlib 3.7.3 (optional)
Tifffile 2023.9.26 (optional)
Revisions
2023.11.1
Initial alpha release.
Notes
The API is not stable yet and might change between revisions.
This library has been tested with a limited number of files only.
The following features are currently not implemented: PT2 and PT3 files, decoding images from T2 formats, bidirectional scanning, sinusoidal correction, and deprecated image reconstruction.
The PicoQuant unified file formats are documented at the PicoQuant-Time-Tagged-File-Format-Demos
Other Python implementations for reading PicoQuant files are Read_PTU.py, readPTU_FLIM, picoquantio, and napari-flim-phasor-plotter.
The development of this library was supported by the Chan Zuckerberg Initiative.
Examples
Read properties and tags from any type of PicoQuant unified tagged file:
>>> pq = PqFile('tests/Settings.pfs') >>> pq.magic <PqFileMagic.PFS: ...> >>> pq.guid UUID('86d428e2-cb0b-4964-996c-04456ba6be7b') >>> pq.tags {...'CreatorSW_Name': 'SymPhoTime 64', 'CreatorSW_Version': '2.1'...} >>> pq.close()
Read metadata from PicoQuant PTU FLIM file:
>>> ptu = PtuFile('tests/FLIM.ptu') >>> ptu.magic <PqFileMagic.PTU: ...> >>> ptu.type <PtuRecordType.PicoHarpT3: 66307> >>> ptu.measurement_mode <PtuMeasurementMode.T3: 3> >>> ptu.measurement_submode <PtuMeasurementSubMode.IMAGE: 3>
Decode TTTR records from file to numpy.recarray and get global times of frame changes from the masks:
>>> decoded = ptu.decode_records() >>> decoded['time'][(decoded['marker'] & ptu.frame_change_mask) > 0] array([1571185680], dtype=uint64)
Decode TTTR records to delay-time histogram per channel:
>>> ptu.decode_histogram(dtype='uint8', asxarray=False) array([[ 5, 7, 7, ..., 10, 9, 2]], dtype=uint8)
Read FLIM histogram as xarray, decoding only the first channel and integrating all histogram bins:
>>> ptu.shape (2, 1, 256, 256, 3126) >>> ptu.dims ('C', 'T', 'Y', 'X', 'H') >>> ptu.coords {'T': ..., 'Y': ..., 'X': ..., 'H': ...} >>> ptu.decode_image(channel=0, dtime=-1, asxarray=True) # doctest: +SKIP <xarray.DataArray (C: 1, T: 1, Y: 256, X: 256, H: 1)> array([[[[[...]]]]], dtype=uint16) Coordinates: * T (T) float64 0.0 * Y (Y) float64 -0.0001304 -0.0001294 ... 0.0001284 0.0001294 * X (X) float64 -0.0001304 -0.0001294 ... 0.0001284 0.0001294 * H (H) float64 0.0 Dimensions without coordinates: C ... >>> ptu.close()
View the image and metadata in a PTU file from the console:
$ python -m ptufile tests/FLIM.ptu
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
Built Distributions
Hashes for ptufile-2023.11.1-cp312-cp312-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c582d7679bd06b9298affcee0238c2e9694e54639965bbb07dc618ee1fe725e3 |
|
MD5 | bf8763b4a34c734443453be1b99dc684 |
|
BLAKE2b-256 | e1ae351f79355e5451d97a2e1e77128c2768562b215ae11592a23a8971b4afcd |
Hashes for ptufile-2023.11.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae84931dc68824b6a000c4a80c9edc12f4d882e4df4cda539a2f6c1eb4bfd650 |
|
MD5 | 1ae3f2ff420d7b08e830dd515c4fb854 |
|
BLAKE2b-256 | 1bb95884582e787d63e04a8780b64352a758e5740ae7383244e49d8faac3120c |
Hashes for ptufile-2023.11.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efd14b955b4465823f40a91dc84b30f2f354ba687d59ce3e78f36b02b2d65b70 |
|
MD5 | f4b9dfeb78481c9dd5a273e87dcb4574 |
|
BLAKE2b-256 | ab25f0783750a5e27e81e50687a97ad54f530a84e629dba56868504873296fee |
Hashes for ptufile-2023.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ec860fb1cc62c93cb55d9032fa3a0e295867823d95605ff161111723ae026f0 |
|
MD5 | 9fdb7e74e4a29a32661038cb26b6f147 |
|
BLAKE2b-256 | 9e91d5e3270e2b1a6e709a794f8c97a08b92ce8045d5c3980f48e18ed9366611 |
Hashes for ptufile-2023.11.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7c1240c87ccc39a0f40c9e43373ac575ca2a53646b2d854d2de2adfdd8375d2 |
|
MD5 | 8123fdb19a978a6e26a6521cef75cce1 |
|
BLAKE2b-256 | a143f40c0e74b875c78670024231165ae70c44c8bb59e2afd461fc00b2140653 |
Hashes for ptufile-2023.11.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8cc01fad172b71c11f3a12ba86098bc851978ddad6fbd6f473e3dc16657b19a |
|
MD5 | d2f9d910cfcf9a8754109ea43629ecca |
|
BLAKE2b-256 | 05a75f30a921593dc02aaf36573aba9ef55c3158d9c72dcaa82156d2d90336ef |
Hashes for ptufile-2023.11.1-cp311-cp311-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95613c3a126ee2e125833ee0eb1d531b7a4649b25b765d38046a7d985e8fbe5b |
|
MD5 | eb7c4fc403702b34483e9fe81b48a2d0 |
|
BLAKE2b-256 | 183d73d45f58da8f7e969b95234c85db209ad5596990e77eeab6c3c1dbcbe95d |
Hashes for ptufile-2023.11.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e323ca6b3a05c84f7e9c3931258cef1eebc9223b12d7f53388d5d6b6c9c13fe |
|
MD5 | ce83ea188744c8ad4d3a4580d1dfd299 |
|
BLAKE2b-256 | b9c185b06286912d3c6974103da7692e6a4c3965b839820278698b2373842392 |
Hashes for ptufile-2023.11.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 027b3735f87ff99c9b297965a2e3b46c59d54f8b1870b23af26acaab10570cdf |
|
MD5 | f3fa25d6f765f3b00862dc2b59e3d2a1 |
|
BLAKE2b-256 | 6b1b1f025b20c2292ad118134db48145ae0b1d00bf818a09dce5d63f540b70e1 |
Hashes for ptufile-2023.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6917265266345308c0c6c126c31c91da1f5938b8a46250670c2d274ba8b5c718 |
|
MD5 | 808749c85bb8d0b3aad4181ca0e0beb1 |
|
BLAKE2b-256 | 72ffd8860652038afa33ae486dcd4bada4fa4ba0b4ca207f9e8a85c911b27157 |
Hashes for ptufile-2023.11.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7965554e82b5739fb48bf503685ae0782278b06cd9de94de1ff73a2a3200ca5e |
|
MD5 | cb8c8c51de5f4c6c762882abe83e1f3f |
|
BLAKE2b-256 | 6772385a1c329dd024bff3bfdff0252da7a511fd5d2acc09aab8d41eb8f68099 |
Hashes for ptufile-2023.11.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a4b582a8426f9fa958dfa3b64621accc52058f27bd153c49394d73364a7ff20 |
|
MD5 | 2a6738bae80938da04dea71cc4a73c6a |
|
BLAKE2b-256 | ec8b7c9888986b88218460b2e50efaa8bf48c778123272c50c8d413c4428770e |
Hashes for ptufile-2023.11.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18b17e4d91e48d8efe0886055e8fa6210962eff8489d448248ae952c3bbc279e |
|
MD5 | 318fff63ffc5faadcade750eec89c6fb |
|
BLAKE2b-256 | 590d825107bfe0519d14a5d55609c96747c6a3c09c6f57be47ac335e5fd748de |
Hashes for ptufile-2023.11.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54adb53fc98b7e549b698bfddb3cd5301192631674428a4c80a7b1637356e631 |
|
MD5 | 0ffbb66871a47adf653bba25a8271f41 |
|
BLAKE2b-256 | 99f20843a87823f0aeecdf6b3a53b61b66b69ca2c82b1c9f2ac07760f3823463 |
Hashes for ptufile-2023.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2edc2d2e81f7629e3574d7627b34bf4a7e9f0121f2a3c513adbc59d7cba3a1c |
|
MD5 | 9c00e9fcc51d6fd1bcdb43ac4291b30d |
|
BLAKE2b-256 | 558c62c5ddf8d897a39546fb7b7421336fa36e952feee9cbe20889a2b028be01 |
Hashes for ptufile-2023.11.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2af62a9dc1710ca7be5f815ed851ad56f216efc0e91aa3d2bd76d19d4af3c64e |
|
MD5 | b2fe4f624129d4a98ee72af9cb6e491f |
|
BLAKE2b-256 | 9e402100b46582d56cd9a8bffeab962945b660a0a5b926079104fb6231420eee |
Hashes for ptufile-2023.11.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 270faea69be013a2bbd6d0c76553bc4584275086847673bc8eb39c6b7cdfd450 |
|
MD5 | 35cce870487612d1b5492c2fd9cd738c |
|
BLAKE2b-256 | 8f3e3ae5fe011f749d490fd25379014a5864391965ad9b2f2e6c8cd450bae14d |
Hashes for ptufile-2023.11.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b70f462dbbe06bc7f2b27dccfd21cceace052605118fa334a0e53ffc0a6509cc |
|
MD5 | 848ac5f2f287e5ee45ff4108d7947c1b |
|
BLAKE2b-256 | 85a7c0ed3a9d76f547ebe4957f6139cda57972a6728d69e17e37634029988c74 |
Hashes for ptufile-2023.11.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41c6af7b31ff8c6e5cbc1e6ffd9d398c9c6390f10e1090e567fe82c34b1ae698 |
|
MD5 | 6d7079e3354418f2afb1a9b6b2bed7fc |
|
BLAKE2b-256 | ad438acce450416d20c45428aade089f5451d782f4bd2abe21e97fd23c6fb540 |
Hashes for ptufile-2023.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059c0688ea8f50bf439186fddbd3bd44bbc934e4c084071dcc24b9a64b59e68a |
|
MD5 | 625b3288e6c541279218886f62aa9e1c |
|
BLAKE2b-256 | 326b3a0c83201e6f846a46129e267090f862d8a15efc09294d2300731c531b39 |
Hashes for ptufile-2023.11.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df6d1a841ec94bb079864b8885d5430b7524376c989512c96826503a23750bc8 |
|
MD5 | d41f135bfef9c7cf2d4dae3acfcda404 |
|
BLAKE2b-256 | bd5597bc358e989e4d476f113e547c0d06acf306727e3593b91732349ffdc3ac |
Hashes for ptufile-2023.11.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88de8db7f0c4410eaa6e7ad58759ef9cc301462fdc0df3f970b7d7b348545a66 |
|
MD5 | ab19050f3f3d55369e87cdc27a63ca7b |
|
BLAKE2b-256 | 7623eec8ffefe193c1b768047babbb5e94a4ef627bd4b7d1be2dead62125c816 |