Skip to main content

Cross-platform, NumPy based module for reading TDMS files produced by LabView

Project description

PyPI Version Build status Documentation Status Code coverage

npTDMS is a cross-platform Python package for reading and writing TDMS files as produced by LabVIEW, and is built on top of the numpy package. Data is read from TDMS files as numpy arrays, and npTDMS also allows writing numpy arrays to TDMS files.

TDMS files are structured in a hierarchy of groups and channels. A TDMS file can contain multiple groups, which may each contain multiple channels. A file, group and channel may all have properties associated with them, but only channels have array data.

Typical usage when reading a TDMS file might look like:

from nptdms import TdmsFile

tdms_file = TdmsFile.read("path_to_file.tdms")
group = tdms_file['group name']
channel = group['channel name']
channel_data = channel[:]
channel_properties = channel.properties

The TdmsFile.read method reads all data into memory immediately. When you are working with large TDMS files or don’t need to read all channel data, you can instead use TdmsFile.open. This is more memory efficient but accessing data can be slower:

with TdmsFile.open("path_to_file.tdms") as tdms_file:
    group = tdms_file['group name']
    channel = group['channel name']
    channel_data = channel[:]

npTDMS also has rudimentary support for writing TDMS files. Using npTDMS to write a TDMS file looks like:

from nptdms import TdmsWriter, ChannelObject
import numpy

with TdmsWriter("path_to_file.tdms") as tdms_writer:
    data_array = numpy.linspace(0, 1, 10)
    channel = ChannelObject('group name', 'channel name', data_array)
    tdms_writer.write_segment([channel])

For more detailed documentation on reading and writing TDMS files, see the npTDMS documentation.

Installation

npTDMS is available from the Python Package Index, so the easiest way to install it is by running:

pip install npTDMS

There are optional features available that require additional dependencies. These are hdf for hdf export, pandas for pandas DataFrame export, and thermocouple_scaling for using thermocouple scalings. You can specify these extra features when installing npTDMS to also install the dependencies they require:

pip install npTDMS[hdf,pandas,thermocouple_scaling]

Alternatively, after downloading the source code you can extract it and change into the new directory, then run:

python pip install .

Limitations

This module doesn’t support TDMS files with XML headers or with extended precision floating point data.

Contributors/Thanks

Thanks to Floris van Vugt who wrote the pyTDMS module, which helped when writing this module.

Thanks to Tony Perkins, Ruben De Smet, Martin Hochwallner and Peter Duncan for contributing support for converting to Pandas DataFrames.

Thanks to nmgeek and jshridha for implementing support for DAQmx raw data files.

License

This project is released under the LGPL-3.0 license. This is a set of additional permissions on top of the GPL-3.0 license. The GPL-3.0 license text is included in the COPYING file, and the LGPL-3.0 permissions are included in the COPYING.LESSER file.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nptdms-1.11.0.tar.gz (182.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nptdms-1.11.0-py3-none-any.whl (169.9 kB view details)

Uploaded Python 3

File details

Details for the file nptdms-1.11.0.tar.gz.

File metadata

  • Download URL: nptdms-1.11.0.tar.gz
  • Upload date:
  • Size: 182.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nptdms-1.11.0.tar.gz
Algorithm Hash digest
SHA256 2c783b10fb52774ad5d94d05db84f4e529ebf2581363a2b551a92b7acd01e986
MD5 2217e14963f3af0694fda6905e7ec5d7
BLAKE2b-256 549aed578455d628a61f9a0bbd96273e470dd98bd64f276055f35ae487c5d0d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nptdms-1.11.0.tar.gz:

Publisher: ci-cd.yml on adamreeve/npTDMS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nptdms-1.11.0-py3-none-any.whl.

File metadata

  • Download URL: nptdms-1.11.0-py3-none-any.whl
  • Upload date:
  • Size: 169.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nptdms-1.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 813aa026991ad675715ee9bb205d89bc942243219f63c66afc4cbd793b8f5bb6
MD5 b1480c4001ed1e43e12193161febc376
BLAKE2b-256 ced915d8ffe3c727d1ab6c6e60e48a9e06116003c09b55a76642904f60dd1bc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nptdms-1.11.0-py3-none-any.whl:

Publisher: ci-cd.yml on adamreeve/npTDMS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page