Skip to main content

Sdtfile is a Python library to read SDT files produced by Becker & Hickl SPCM software. SDT files contain time correlated single photon counting instrumentation parameters and measurement data.

Becker & Hickl GmbH is a manufacturer of equipment for photon counting.

Author:

Christoph Gohlke

License:

BSD-3-Clause

Version:

2026.7.30

DOI:

10.5281/zenodo.10125608

Quickstart

Install the sdtfile package and all dependencies from the Python Package Index:

python -m pip install -U sdtfile[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.12.10, 3.13.14, 3.14.6, 3.15.0b4 64-bit

  • Numpy 2.5.1

  • Imagecodecs 2026.6.26 (optional for LZ4 compressed data blocks)

  • Lz4 4.4.5 (optional alternative to imagecodecs for LZ4 compressed data blocks)

Revisions

2026.7.30

  • Add sdtwrite function.

  • Support SET files without measurement description and data blocks.

2026.7.17

  • Fix decompression of LZ4-compressed data blocks.

  • Add fallback to lz4 module if imagecodecs is not installed.

2026.7.12

  • Fix BlockNo attribute names (breaking).

  • Try power-of-two padded image shapes when block/adc_re > image_y * image_x.

  • Support LZ4 compressed and larger than 4 GB data blocks (not tested).

  • Update MeasureInfoExt structure with MeasStopInfoExt and MWL fields.

  • Use BinaryFile for file I/O.

  • Add simple CLI to preview data and metadata in SDT files.

2026.6.29

  • Fix reading SDT files with truncated embedded ZIP files (#8).

2026.6.6

  • Fix potential file handle leak in SdtFile init.

  • Add options for memory-mapping and locked reading to BinaryFile.

  • Add option to memory-map SDT files.

  • Drop support for Python 3.11 and numpy 2.0 (SPEC0).

  • Support Python 3.15.

2026.2.8

  • Derive SdtFile from BinaryFile (breaking).

  • Rename MEASURE_INFO.MeasHISTInfo to HISTInfo to match C struct (breaking).

  • Revise shaping of FCS_BLOCK data (breaking).

  • Fix code review issues.

2026.1.14

  • Improve code quality.

2025.12.12

  • Add new SPC modules and MEASURE_INFO_EXT fields.

  • Drop support for Python 3.10.

2025.5.10

Refer to the CHANGES file for older revisions.

Notes

SDT files begin with a FILE_HEADER containing byte offsets to four sections: an ASCII info block, a setup block (ASCII and/or binary instrument parameters), one or more MEASURE_INFO records (CFD/TAC/ADC settings, scan geometry, timestamps, module identity), and one or more data blocks each preceded by a BLOCK_HEADER encoding the creation mode, content type (FLIM image, FCS, MCS, etc.), and element dtype. The data blocks are photon-count histograms shaped from MEASURE_INFO fields, typically (image_y, image_x, adc_re) of type uint16/uint32, and may be ZIP or LZ4-compressed.

Currently “Flow Data” are not supported.

References

  1. W Becker. The bh TCSPC Handbook. 9th Edition. Becker & Hickl GmbH 2021. pp 879. https://www.becker-hickl.com/literature/documents/flim/the-bh-tcspc-handbook-9th-edition-2021/

  2. SPC_data_file_structure.h header file. Part of the Becker & Hickl SPCM software installation. https://www.becker-hickl.com/products/spcm-data-acquisition-software/

Examples

Read image and metadata from an “SPC Setup & Data File”:

>>> sdt = SdtFile('image.sdt')
>>> int(sdt.header.revision)
588
>>> sdt.info.id[1:-1]
'SPC Setup & Data File'
>>> int(sdt.measure_info[0].scan_x)
128
>>> float(sdt.measure_info[0].tac_r)  # doctest: +NUMBER
5.0e-08
>>> len(sdt.data)
1
>>> image = sdt.data[0]
>>> image.shape
(128, 128, 256)
>>> sdt.times[0].shape
(256,)
>>> sdt.close()

Write image and select metadata to an SDT file:

>>> sdtwrite('image_out.sdt', image, tac_r=5e-8, compress=True)

Read data and metadata from an “SPC Setup & Data File” with multiple data sets:

>>> sdt = SdtFile('fluorescein.sdt')
>>> len(sdt.data)
4
>>> sdt.data[3].shape
(1, 1024)
>>> sdt.times[3].shape
(1024,)
>>> int(sdt.setup.bh_bin_hdr['soft_rev'])
850
>>> sdt.close()

Read image data from an “SPC FCS Data File” as numpy array:

>>> sdt = SdtFile('fcs.sdt')
>>> sdt.info.id[1:-1]
'SPC FCS Data File'
>>> len(sdt.data)
1
>>> sdt.data[0].shape
(512, 512, 256)
>>> sdt.times[0].shape
(256,)
>>> sdt.close()

View the image and metadata in an SDT file from the console:

$ python -m sdtfile image.sdt

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sdtfile-2026.7.30.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

sdtfile-2026.7.30-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file sdtfile-2026.7.30.tar.gz.

File metadata

  • Download URL: sdtfile-2026.7.30.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for sdtfile-2026.7.30.tar.gz
Algorithm Hash digest
SHA256 a530f827afe55e4c5c39dce243b9a9b7ebdd557013038b73e519a251704fe676
MD5 e3d9176693d9a2bab099ebaed438abcd
BLAKE2b-256 f572e5d6116071c70ffddb6dddbf012981d80363acf9b105d15b135bb001162a

See more details on using hashes here.

File details

Details for the file sdtfile-2026.7.30-py3-none-any.whl.

File metadata

  • Download URL: sdtfile-2026.7.30-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for sdtfile-2026.7.30-py3-none-any.whl
Algorithm Hash digest
SHA256 64081ab44927bc7b43c61f793f9acd4de2b35f10a647da9abada0f3db68848a8
MD5 04ab3d8d29dea05a2d13d26affcc779e
BLAKE2b-256 62f5f1c18ec8cce06a7cdd02e5dd7cc669b6937163e14301f58d16e58b1e61d5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2026.7.30 This release

2 files

2026.7.17

2 files

2026.7.12

2 files

2026.6.29

2 files

2026.6.6

2 files

2026.2.8

2 files

2026.1.14

2 files

2025.12.12

2 files

2025.5.10

2 files

2025.3.25

2 files

2024.12.6

2 files

2024.11.24

2 files

2024.5.24

2 files

2024.4.24

2 files

2023.9.28

2 files

2023.8.30

2 files

2022.9.28

2 files

2022.2.2

2 files

2021.11.18

2 files

2021.3.21

2 files

2020.12.10

2 files

2020.8.3

2 files

2020.1.1

2 files

2019.7.28

2 files

2019.1.1

2 files

2018.10.18

2 files

2018.8.29

2 files

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