tdm_loader package
Subpackages
Submodules
tdm_loader.tdm_loader module
This module allows National Instruments TDM/TDX files to be accessed like NumPy structured arrays.
To install the newest version use:
pip install tdm-loader
Sample usage:
import tdm_loader
data_file = tdm_loader.OpenFile('filename.tdm')
Access a channel by channel group and channel index combination:
data_file.channel(channel_group, channel)
Get a dict of all channels in a channel group:
data_file.channel_dict(channel_group)
Search for a column name. A list of all column names that contain
search_term
and their indices will be returned:
data_file.channel_search(search_term)
- class tdm_loader.tdm_loader.OpenFile(tdm_path, tdx_path='', encoding='utf-8')[source]
Bases:
object
Class for opening a National Instruments TDM/TDX file.
- Parameters:
- channel(channel_group, channel, occurrence=0, ch_occurrence=0)[source]
Returns a data channel by its channel group and channel index.
- Parameters:
channel_group (int or str) – The index or name of the channel group.
channel (int or str) – The index or name of the channel inside the group.
occurrence (int, Optional) – Gives the nth occurrence of the channel group name. By default the first occurrence is returned. This parameter is only used when channel_group is given as a string.
ch_occurrence (int, Optional) – Gives the nth occurrence of the channel name. By default the first occurrence is returned. This parameter is only used when channel_group is given as a string.
- channel_description(channel_group, channel, occurrence=0, ch_occurrence=0)[source]
Returns the description of the channel at given channel group and channel indices.
- channel_dict(channel_group, occurrence=0)[source]
Returns a dict representation of a channel group.
- channel_group_index(channel_group_name, occurrence=0)[source]
Returns the index of a channel group with the given name.
- channel_group_name(channel_group)[source]
Returns the name of the channel group at the channel group index.
- Parameters:
channel_group (int) – The index of the channel group.
- channel_group_search(search_term)[source]
Returns a list of channel group names that contain
search term
. Results are independent of case and spaces in the channel name.
- channel_name(channel_group, channel, occurrence=0)[source]
Returns the name of the channel at given channel group and channel indices.
- channel_search(search_term)[source]
Returns a list of channel names that contain
search term
. Results are independent of case and spaces in the channel name.- Parameters:
- Returns:
list of (str, int, int) or list of (str, int) (latter case for return_column = True) Returns the found channel names as tuple of full name and column index or channel group and channel indices depending on the value of return_column.
- Return type:
found_terms