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

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.2
File Size Uploaded Provenance Actions
tdfpy-5.0.2.tar.gz 120.4 kB With provenance Details for tdfpy-5.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 234.1 kB

Release files / tdfpy-5.0.2.tar.gz

Download URL tdfpy-5.0.2.tar.gz
Size 120.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7c93310700fd07dd9edf0a17f21d014a81a6a6ae671b489be8580479b5a9a71c
BLAKE2b-256 checksum
How to use checksums
643d8b713094881807f09dcc2c43f27160a1a2477a40bf9e18764537e51b388d
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 28, 2026.

Transparency log

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

Download URL tdfpy-5.0.2-py3-none-any.whl
Size 113.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70b15c434b1b0d9c48824533fe15482bca8a1d31ea4a7fdfea89d6be4e945c22
BLAKE2b-256 checksum
How to use checksums
1bad327bf55da705812af9a41fd7fe7e0dfabf62b7c4df14c8bda29949f10630
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 28, 2026.

Transparency log

Security for tdfpy 5.0.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tdfpy-5.0.2.tar.gz

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 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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