Cross-platform, NumPy based module for reading TDMS files produced by LabView
Project description
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 .
Links
Source code lives at https://github.com/adamreeve/npTDMS and any issues can be reported at https://github.com/adamreeve/npTDMS/issues. Documentation is available at http://nptdms.readthedocs.io.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c783b10fb52774ad5d94d05db84f4e529ebf2581363a2b551a92b7acd01e986
|
|
| MD5 |
2217e14963f3af0694fda6905e7ec5d7
|
|
| BLAKE2b-256 |
549aed578455d628a61f9a0bbd96273e470dd98bd64f276055f35ae487c5d0d5
|
Provenance
The following attestation bundles were made for nptdms-1.11.0.tar.gz:
Publisher:
ci-cd.yml on adamreeve/npTDMS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nptdms-1.11.0.tar.gz -
Subject digest:
2c783b10fb52774ad5d94d05db84f4e529ebf2581363a2b551a92b7acd01e986 - Sigstore transparency entry: 1939957061
- Sigstore integration time:
-
Permalink:
adamreeve/npTDMS@824119ee0a99db33a8a442e38c8a4fd9a0d4f6de -
Branch / Tag:
refs/tags/1.11.0 - Owner: https://github.com/adamreeve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@824119ee0a99db33a8a442e38c8a4fd9a0d4f6de -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
813aa026991ad675715ee9bb205d89bc942243219f63c66afc4cbd793b8f5bb6
|
|
| MD5 |
b1480c4001ed1e43e12193161febc376
|
|
| BLAKE2b-256 |
ced915d8ffe3c727d1ab6c6e60e48a9e06116003c09b55a76642904f60dd1bc5
|
Provenance
The following attestation bundles were made for nptdms-1.11.0-py3-none-any.whl:
Publisher:
ci-cd.yml on adamreeve/npTDMS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nptdms-1.11.0-py3-none-any.whl -
Subject digest:
813aa026991ad675715ee9bb205d89bc942243219f63c66afc4cbd793b8f5bb6 - Sigstore transparency entry: 1939957140
- Sigstore integration time:
-
Permalink:
adamreeve/npTDMS@824119ee0a99db33a8a442e38c8a4fd9a0d4f6de -
Branch / Tag:
refs/tags/1.11.0 - Owner: https://github.com/adamreeve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@824119ee0a99db33a8a442e38c8a4fd9a0d4f6de -
Trigger Event:
push
-
Statement type: