Skip to main content

tdmread

Zero-dependency, typed reader for NI TDM/TDX files (an XML .tdm header paired with a binary .tdx data file), using only the Python standard library.

Install

pip install tdmread

Usage

from tdmread import read_tdm

dataset = read_tdm("measurement.tdm")  # the .tdx is found via the header reference

for group in dataset.groups:
    print(group.name)
    for channel in group.channels:
        print(f"  {channel.name} [{channel.unit}]: {channel.data[:5]}")

# Direct lookup by name.
voltage = dataset.group("Measurements").channel("voltage")
print(voltage.value_type, len(voltage.data))

Each Channel carries its name, unit, description, the TDM value_type, the representation (explicit or implicit_linear), the header minimum/maximum and datatype, and the decoded data as a plain tuple of numbers. read_tdm also returns dataset metadata on dataset.metadata (name, title, description, author, datetime). Pass a second argument to point at a .tdx in a non-default location: read_tdm("m.tdm", "elsewhere/m.tdx").

# Convenience helpers.
for group, channel in dataset.channels():
    print(group.name, channel.name, len(channel))

values = dataset.group("Amplitudes").channel("A = 1").to_list()
array = dataset.group("Amplitudes").channel("A = 1").to_numpy()  # needs numpy installed

Command line

Installing the package also installs a tdmread console script:

tdmread info measurement.tdm
tdmread channels measurement.tdm
tdmread dump measurement.tdm --group Amplitudes --channel "A = 1" --format csv
tdmread dump measurement.tdm -g Amplitudes -c "A = 1" -f json -o values.json

info prints the dataset metadata and a group summary, channels lists every channel with its type and length, and dump writes one channel to CSV or JSON (to standard output, or to a file with -o). Errors go to standard error with exit code 1.

Why

npTDMS reads the newer .tdms format but not the older .tdm/.tdx pair, so it is no help to anyone holding .tdm data. Two packages do read .tdm/.tdx, but each pulls in weight: tdm-loader depends on NumPy, and TDMtermite ships a compiled C++ extension. tdmread fills the remaining gap: a small, fully typed reader with no runtime dependencies and nothing to build, for scripts and environments where adding NumPy or a native extension is unwelcome.

Supported subset

tdmread targets the common documented TDM layout and is honest about its limits:

  • Numeric channels with the explicit sequence representation.
  • Numeric channels with the implicit_linear representation, generated as offset + index * increment from the header (no .tdx needed for those).
  • Value types eInt8/16/32/64, their unsigned variants, eFloat32, and eFloat64, in both littleEndian and bigEndian byte order.

It does not yet decode string, timestamp, or extended-precision channels, raw_linear scaled sequences, or per-sample flags; those raise UnsupportedTdmError rather than returning wrong numbers. Issues and sample files that broaden the coverage are welcome.

License

MIT. See LICENSE.

Metadata

Release files for tdmread 0.2.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 tdmread 0.2.1
File Size Uploaded Provenance Actions
tdmread-0.2.1.tar.gz 30.0 kB Without provenance Details for tdmread-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 43.5 kB

Release files / tdmread-0.2.1.tar.gz

Download URL tdmread-0.2.1.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
12d8f47240fcbdd32999d7b8c9a6cbc3092b6473b230d6479414d464072c8f93
BLAKE2b-256 checksum
How to use checksums
c7dcf79f3389cce8168d8ae0124333e06796fedd369a1d2ed55fdaf793f1098e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / tdmread-0.2.1-py3-none-any.whl

Download URL tdmread-0.2.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72f1ef4b58502b2203ff9bac64cb3bb0ad4b99d0a0a7ad43bfef278a0cae456c
BLAKE2b-256 checksum
How to use checksums
1b5c2a4a2c369c21198a591bb07825fe1e863dcdf258400589681e023f5339e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for tdmread 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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