Skip to content

Document ability to use in keyword with TdmsFile and TdmsGroup #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions nptdms/tdms.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class TdmsFile(object):
tdms_file = TdmsFile.read(tdms_file_path)
group = tdms_file[group_name]

And you can check for the presence of a group with the ``in`` keyword::

contains_group = group_name in tdms_file

Iterating over a TdmsFile produces the names of groups in this file,
or you can use the groups method to directly access all groups::

Expand Down Expand Up @@ -347,6 +351,10 @@ class TdmsGroup(object):

channel = group[channel_name]

And you can check for the presence of a channel with the ``in`` keyword::

contains_channel = channel_name in group

Iterating over a TdmsGroup produces the names of channels in this group,
or you can use the channels method to directly access all channels::

Expand Down