LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance Needed with Reading Specific TDMS Properties via nptdms Library

Hi everyone,

I'm encountering an unexpected behavior while parsing a TDMS file using the nptdms library. The TDMS file contains two distinct property types visible in Excel:

  1. Primary properties displayed with black bold formatting (e.g., "Length", "Datatype")
  2. Secondary properties shown in non-bold italic style (e.g., "NI_ChannelName")

Currently, my implementation successfully retrieves the second category using nptdms, but I'm unable to access the first type ("Length" specifically). Could you please advise how to properly extract these bold-formatted properties?

Any guidance on method selection, attribute path configuration, or potential library-specific considerations would be greatly appreciated.

0 Kudos
Message 1 of 3
(216 Views)

Hi LALALAAALLAA,

 

The behavior you're observing when parsing TDMS files using the nptdms library - stems from how TDMS metadata is studctured and how nptdms interprets it.

The bold properties you see in Excel are not user-defined properties, they are structural metadata that describe the TDMS file's internal layout.These are not stored as regular properties in the TDMS file and therefore are not accessible via the standard .properties dictionary in nptdms.

 

To acceess these, you need to use specific attributes or methods provided by nptdms.

To het the number of data points (i.e., the "Length") in a channel: 

 

from nptdms import TdmsFile

 

tdms_file = TdmsFile.read("your_file.tdms")
group = tdms_file["GroupName"]
channel = group["ChannelName"]

 

length = len(channel)  # This gives you the "Length"
 
To get the data type of channel
 

dtype = channel.data_type  # This gives you the "Datatype"
 
These are user-defined or NI-defined properties and areaccessible like this
 

channel.properties.get("NI_ChannelName")
 
Overall
Structural (e.g., Length, Datatype) - Bold - len(channel), channel.data_type
User-defined (e.g., NI_ChannelName) - Italic - channel.properties.get("NI_ChannelName")
 

0 Kudos
Message 2 of 3
(149 Views)

Hi mane__avagyan,

Thank you very much for taking the time to share your insightful suggestion. I truly appreciate your effort and valuable input. I will definitely give your method a try and see how it works out. I sincerely thank you for your guidance and support. 😊

Best regards,
LALALAAALLAA

0 Kudos
Message 3 of 3
(137 Views)