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): ...@@ -1046,16 +1046,26 @@ def _readdat(path, file_in):
def _readtdms(path, file_in): def _readtdms(path, file_in):
""" Helper function to read *.tdms file """ """ Helper function to read *.tdms file """
f = nptdms.TdmsFile(path+file_in)
df_raw = dict() try:
time = f.group_channels('Untitled')[0].time_track() # in [s] f = nptdms.TdmsFile(path+file_in)
for channel in f.group_channels('Untitled'): time = f.group_channels('Untitled')[0].time_track() # in [s]
channel_name = channel.path.replace('\'', '').split('/')[-1] df_raw = dict()
df_raw[channel_name] = channel.data for channel in f.group_channels('Untitled'):
shearforce = df_raw['Shear Force'] # in [N] channel_name = channel.path.replace('\'', '').split('/')[-1]
normalforce = df_raw['Normal Force'] # in [N] df_raw[channel_name] = channel.data
liddispl = df_raw['Lid Displacement'] # in [mm] shearforce = df_raw['Shear Force'] # in [N]
velocity = df_raw['Velocity'] # in [mm/s] 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, data = {'time': time,
'velocity': velocity, 'velocity': velocity,
'normalforce': normalforce, '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