Skip to main content

tdmslens

Inspect NI TDMS measurement files from the command line or from an AI agent over MCP. TDMS is the format LabVIEW, NI-DAQmx, VeriStand and FlexLogger write test and DAQ data in. tdmslens reads it without NI software and returns compact JSON: the file's layout, exact statistics over every sample, and bounded slices of a channel. It can also write channels to CSV.

A language model cannot read a 50 MB recording, and given a preview it will guess. tdmslens streams the whole file and reports where things happen. For example, a strain channel with a sensor stuck for half a second:

$ tdmslens stats run42.tdms --group Rig --channel Strain --low -0.01 --high 0.01
{
  "channel": "Strain", "count": 2000000, "nan": 0,
  "max": 0.25, "max_at": {"index": 1500000, "time_s": 150.0, "time": "2026-06-01T03:32:30.000000Z"},
  "mean": 0.000626, "std": 0.012524, "rms": 0.012540,
  "longest_constant_run": {"value": 0.25, "start": 1500000, "length": 5000, "time_s": 150.0},
  "range_check": {"above": 5000, "excursions": 1,
                  "excursions_listed": [{"start": 1500000, "length": 5000, "peak": 0.25, "time_s": 150.0}]}
}

(Output shortened and rounded.)

Tools

Tool What it returns
tdms_info File, group and channel properties; each channel's data type, length and unit; for waveform channels the sample rate, start time and duration. Reads no samples. Paged.
tdms_stats Over every sample in a window. Numeric: count, NaN and infinity counts, min and max with the index and time where they occur, mean, population standard deviation, RMS, and the longest run of one repeated value (stuck or saturated sensor). With low/high: samples outside the range, the first and worst ones, and the excursions. Timestamp: order, backwards steps, nominal interval and gaps. Boolean and string: counts.
tdms_read Samples of one channel, at most max_points (default 500, up to 5000). Longer windows are reduced to the min and max of each bucket, plus a null where the bucket has NaN, so spikes and dropouts survive (minmax), or to every k-th sample (decimate).
tdms_export Channels of one group to a new .csv, .tsv or .txt file, with an index column and a time_s column when the channels share timing.

Sample indices count from 0 within a channel. For waveform channels (wf_increment) every index comes with time_s from the waveform start, and with an absolute UTC time when the file stores wf_start_time. LabVIEW stores 1904-01-01 for relative-time waveforms; that is treated as "no absolute time".

Install

pip install tdmslens            # CLI and Python API
pip install "tdmslens[mcp]"     # plus the MCP server

Python 3.10 or newer. Dependencies: npTDMS (LGPL-3.0) and numpy. No NI software is needed.

Claude Code, Cursor and other MCP clients

claude mcp add tdmslens -- uvx --from "tdmslens[mcp]" tdmslens-mcp

Or in a client's JSON configuration:

{"mcpServers": {"tdmslens": {"command": "uvx", "args": ["--from", "tdmslens[mcp]", "tdmslens-mcp"]}}}

The three reading tools are marked read-only; tdms_export is marked as writing.

Hermes Agent

The hermes/ folder is a Hermes plugin with the same four tools. It applies Hermes' read denylist to every file it reads and Hermes' write denylist to every export.

Python

import tdmslens
tdmslens.info("run42.tdms")
tdmslens.stats("run42.tdms", group="Rig", low=-0.01, high=0.01)
tdmslens.read("run42.tdms", "Rig", "Pressure", max_points=1000)
tdmslens.export_csv("run42.tdms", "run42.csv", "Rig", step=10)

What it handles

  • Files from LabVIEW, the NI TDMS C library and DAQmx logging, TDMS 1.0 and 2.0, little and big endian, many segments, interleaved and defragmented data, and .tdms_index files.
  • DAQmx raw data with NI scaling (NI_Scale[n]_*): values come out scaled, and the channel is marked daqmx_scaled.
  • Recordings cut off by a crash or power loss: the samples present are read and the file is marked incomplete_final_segment. NI's own TDMS library refuses such a file.
  • All TDMS data types: integers up to 64 bits, single and double floats, complex, booleans, strings and timestamps. Complex channels are counted but not summarised.

Limits

Every result is size-capped: 100 channels per info page (up to 500), 60 properties per object, 300 characters per string, 5000 points per read, 20 listed gaps or excursions per channel, 200 channels per stats call. tdms_stats stops after 120 seconds and says which channel and index it reached; tdms_export stops at max_rows (default 1,000,000) or after 600 seconds and says so. An export is written to a temporary file in the destination folder and moved into place when complete; it never replaces a file unless overwrite is true, and never the TDMS file it reads. NaN and infinite values appear as null in JSON (counted under nan and inf). In a reduced tdms_read, a bucket containing NaN keeps a null at its first NaN, so dropouts stay visible. Empty-string properties are left out of tdms_info, and one tdms_info result returns at most about 200,000 characters of property text; past that, properties are counted, not shown. Exported files are created with the user's normal file permissions.

How it is tested

  • Unit tests compare every statistic with numpy over random data, read in blocks as small as one sample, so every chunk-boundary case is exercised.
  • npTDMS's real example recordings: DAQmx raw data with scaling, DAQmx digital lines, big-endian, raw timestamps.
  • bench/ni/ writes a 56 MB corpus with NI's own TDMS library (four 2-million-sample channels with a spike, a NaN dropout and a stuck value, a timestamp channel with gaps, a defragmented copy and a crash-truncated copy) and checks tdmslens against NI's reader: every count, extreme, position, mean, standard deviation, range count and exported value matches.
  • The MCP server is tested over stdio with the MCP client SDK, and the Hermes plugin passes hermes plugins validate.

License

MIT. npTDMS, which tdmslens depends on, is LGPL-3.0.

Metadata

Release files for tdmslens 0.1.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 tdmslens 0.1.0
File Size Uploaded Provenance Actions
tdmslens-0.1.0.tar.gz 34.5 kB With provenance Details for tdmslens-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 58.1 kB

Release files / tdmslens-0.1.0.tar.gz

Download URL tdmslens-0.1.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e74dd6e722cffb6b9277d288ea0cd84efcc49a318db1e7392353ef1499624751
BLAKE2b-256 checksum
How to use checksums
794e5f37f30c1fb59546661fae4f61c90942a2240072df6b28184e6c66bf63ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 5, 2026.

Transparency log

Release files / tdmslens-0.1.0-py3-none-any.whl

Download URL tdmslens-0.1.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0f929a696828c8a14cf5233d7c840f36ec7735ab9baf016ed8789306391ede4
BLAKE2b-256 checksum
How to use checksums
780e6bcb4ae0e8017fae731958e54dbc7ceaf537bd8b6e16432d8330f34826e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 5, 2026.

Transparency log

Security for tdmslens 0.1.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tdmslens-0.1.0.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 Dec 5, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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