In [1]:
import os
In [3]:
# os.path.dirname(os.path.abspath(__file__)) # directory of the script being run
In [4]:
os.getcwd()
Out[4]:
In [10]:
print(os.path.abspath("../../../../"))
# os.listdir(os.path.abspath("../../../../"))
In [12]:
print(os.path.isdir(os.path.abspath("../../../../") + "/tdms/"))
os.listdir(os.path.abspath("../../../../") + "/tdms/")
Out[12]:
In [5]:
tdms_test_fixtures_path = os.path.abspath("../../../../") + "/tdms/test/fixtures/"
In [17]:
for file in os.listdir(tdms_test_fixtures_path):
if file.endswith(".tdms"):
print(file)
In [2]:
import nptdms
from nptdms import TdmsFile
In [5]:
example_tdms_file = TdmsFile(tdms_test_fixtures_path + "example.tdms")
print(type(example_tdms_file))
print(dir(example_tdms_file))
#example_channel = example_tdms_file.object('Group', 'Channel1')
#data = channel.data
cf. https://nptdms.readthedocs.io/en/latest/apireference.html
objects – A dictionary of objects in the TDMS file, where the keys are the object paths.
In [12]:
print(type(example_tdms_file.objects))
print(dir(example_tdms_file.objects))
print(example_tdms_file.objects.keys())
memmap __init__(file, memmap_dir=None)
Initialise a new TDMS file object, reading all data.
memmap_dir – The directory to store memmapped data files in, or None to read data into memory. The data files are created as temporary files and are deleted when the channel data is no longer used. tempfile.gettempdir() can be used to get the default temporary file directory.
In [3]:
print(os.path.abspath(os.getcwd()))
In [6]:
example_tdms_file = TdmsFile(tdms_test_fixtures_path + "example.tdms", os.path.abspath(os.getcwd()) + "/tempdata/")
In [7]:
print(example_tdms_file.memmap_dir)
cf. https://nptdms.readthedocs.io/en/latest/apireference.html
object(*path)
Get a TDMS object from a file.
.groups
Return the names of groups in the file.
In [8]:
print(example_tdms_file.groups())
In [ ]: