Commit 3aafea6c authored by Michael Rudolf's avatar Michael Rudolf
Browse files

Updated to new version of nptdms

parent dae427a0
......@@ -1046,16 +1046,26 @@ def _readdat(path, file_in):
def _readtdms(path, file_in):
""" Helper function to read *.tdms file """
f = nptdms.TdmsFile(path+file_in)
df_raw = dict()
time = f.group_channels('Untitled')[0].time_track() # in [s]
for channel in f.group_channels('Untitled'):
channel_name = channel.path.replace('\'', '').split('/')[-1]
df_raw[channel_name] = channel.data
shearforce = df_raw['Shear Force'] # in [N]
normalforce = df_raw['Normal Force'] # in [N]
liddispl = df_raw['Lid Displacement'] # in [mm]
velocity = df_raw['Velocity'] # in [mm/s]
try:
f = nptdms.TdmsFile(path+file_in)
time = f.group_channels('Untitled')[0].time_track() # in [s]
df_raw = dict()
for channel in f.group_channels('Untitled'):
channel_name = channel.path.replace('\'', '').split('/')[-1]
df_raw[channel_name] = channel.data
shearforce = df_raw['Shear Force'] # in [N]
normalforce = df_raw['Normal Force'] # in [N]
liddispl = df_raw['Lid Displacement'] # in [mm]
velocity = df_raw['Velocity'] # in [mm/s]
except AttributeError as _:
with nptdms.TdmsFile.open(path+file_in) as f:
time = f['Untitled']['Shear Force'].time_track() # in [s]
shearforce = f['Untitled']['Shear Force'][:] # in [N]
normalforce = f['Untitled']['Normal Force'][:] # in [N]
liddispl = f['Untitled']['Lid Displacement'][:] # in [mm]
velocity = f['Untitled']['Velocity'][:] # in [mm/s]
data = {'time': time,
'velocity': velocity,
'normalforce': normalforce,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment