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

Metadata

Release files for tdfpy 5.0.1

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.1
File Size Uploaded
tdfpy-5.0.1.tar.gz 120.4 kB Details

Built distribution (wheel)

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

Total release size: 234.0 kB

Release files / tdfpy-5.0.1.tar.gz

Download URL tdfpy-5.0.1.tar.gz
Size 120.4 kB
Tags Source
SHA-256 checksum
How to use checksums
032fea0f6357ab96ea1ada6f2046ba26d4f5d4a184e26f747eae29a598a7566f
BLAKE2b-256 checksum
How to use checksums
b6ee76773b976b0729b1319361b84982d5ab63f6ff58f9426c2559455381c582
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 Oct 8, 2026.

Transparency log

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

Download URL tdfpy-5.0.1-py3-none-any.whl
Size 113.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
701a83f7ecfaf449f86c6eaf6f3304e3ff232c991f6f0c7cdd10de033df06113
BLAKE2b-256 checksum
How to use checksums
7a92e6e47e39c840340c5b5d5f40498bf2bc6198c8bad5aaa122b2ffdcd70e69
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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.0.1 This release

2 release files

5.0.0

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