Skip to main content
TDFpy Logo

A Python package for extracting data from Bruker timsTOF data files (.tdf and .tdf_bin). Includes a Numba-accelerated centroiding algorithm for efficient extraction of ion mobility data.

Python package codecov PyPI version DOI Python 3.12+ License: MIT

tdfpy reads Bruker timsTOF .d acquisitions straight from analysis.tdf and analysis.tdf_bin — no Bruker native library required. It gives you familiar Python objects for DDA, DIA, and PRM runs, plus a tunable, Numba-accelerated centroiding pipeline for pulling clean, ion-mobility-resolved peaks out of raw PASEF frames.

It's for proteomics and mass spec developers who want to script against timsTOF data without hand-rolling SQLite queries or reverse-engineering the binary frame format.

Why tdfpy?

  • Pure Python, no native dependency — analysis.tdf_bin is decoded directly, so it runs on Linux, macOS, and Windows, x86-64 and ARM
  • One API for DDA, DIA, and PRM — frames, precursors, isolation windows, targets, and transitions are all typed Python objects
  • Composable peak pipeline — chain region exclusion, smoothing, and noise filters before centroiding, or use short-hand defaults
  • Two centroiders — a Numba-JIT'd greedy merge in float m/z space, and a watershed region-grower in integer TOF-index space, swappable without touching surrounding code
  • Lazy spectral access — frame metadata loads upfront; raw peak data is only decoded when you call .merged_peaks(), .scan_peaks(), .raw_peaks(), or .centroid()
  • Query by m/z and RT, not just row index

Installation

pip install tdfpy

Requires Python 3.12+. On Python 3.12/3.13 the zstandard package is installed automatically; Python 3.14+ uses the standard library's zstd module.

Optional extras:

pip install "tdfpy[viz]"  # matplotlib-based plotting helpers
pip install "tdfpy[mcp]"  # MCP server for AI-agent access to acquisitions

Quick Start

from tdfpy import DDA

with DDA("sample.d") as dda:
    # Iterate over MS1 frames
    for frame in dda.ms1:
        print(f"Frame {frame.frame_id} at RT {frame.rt:.1f}s")
        peaks = frame.centroid()  # shape (N, 3): [m/z, intensity, 1/K0]
        print(f"  {len(peaks)} centroided peaks")
        break

    # Iterate over precursors (MS2)
    for precursor in dda.precursors:
        print(f"Precursor {precursor.precursor_id}: {precursor.largest_peak_mz:.4f} m/z")
        peaks = precursor.merged_peaks()  # MS2 centroided by tdfpy (mobility collapse + merge)
        break

DIA and PRM acquisitions work the same way with DIA(...) and PRM(...); see the getting started guide for both.

What else it can do

Feature Example
Lookups & queries dda.precursors.query(precursor_mz=1292.63, mz_tolerance=20.0, rt=2400.0, rt_tolerance=30.0) — by ID or by m/z/RT window
Custom peak pipelines frame.centroid(exclude=ChargeStateRegion(), smooth=Smooth(...), noise=[MadThreshold(k=3), ...], centroid=WatershedCentroider(...))
Noise filter shorthand frame.centroid(noise="mad") or frame.centroid(noise=500.0) for common cases
CLI validation tdfpy validate sample.d --full checks every binary frame without modifying the acquisition
MCP server tdfpy-mcp exposes acquisition inspection and spectrum extraction as tools for AI agents

Full pipeline options (region exclusion, smoothing, the two centroiders, and the noise-filter chain) are covered in the analysis guide and API reference.

tdfpy is the timsTOF reader in the tacular-omics family. mzmlpy reads mzML files the same way, and spxtacular builds spectrum-processing pipelines on top of either.

Documentation

Full documentation: tacular-omics.github.io/tdfpy

Citation

If you use tdfpy in published work, please cite it — see CITATION.cff or the DOI record.

License

MIT

Release files for tdfpy 5.0.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 tdfpy 5.0.0
File Size Uploaded
tdfpy-5.0.0.tar.gz 622.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tdfpy 5.0.0
File Interpreter ABI Platform
tdfpy-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 735.5 kB

Release files / tdfpy-5.0.0.tar.gz

Download URL tdfpy-5.0.0.tar.gz
Size 622.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd89144018f2554684f739f485958ca18da7974c19e291775fb2ab1329003fd5
BLAKE2b-256 checksum
How to use checksums
5f4a083e72dea58751ef7f3ed08fad86431be9a90e99e5a3fcd9e2a8e8ba4835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / tdfpy-5.0.0-py3-none-any.whl

Download URL tdfpy-5.0.0-py3-none-any.whl
Size 113.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc6a6f8366a5a75e4b85ec4be6458ff1ae1f1d0148c48d53ace9c180331d7649
BLAKE2b-256 checksum
How to use checksums
88e872c5423fdacdba5dfaa14edfffa194efe26b782a0200b75c0e95327a17fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.2.0

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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