01-18-2023 10:36 PM
This should meet your requirement.
01-19-2023 09:07 AM
You can also enable TDMS logging, which captures the t0 of the first sample. You can then browse TDMS files or read using npTDMS · PyPI.
01-21-2023 11:48 AM
Can you please show to you extract t0 (assuming that's the only one available from the log file?
tdms_file = TdmsFile.read(os.getcwd() + '\data.tdms', raw_timestamps = True)
for group in tdms_file.groups():
group_name = group.name
print(group.properties)
for channel in group.channels():
print(channel.properties)
The above code gives me this ouptut:
OrderedDict()
OrderedDict([('NI_Scaling_Status', 'unscaled'), ('NI_Number_Of_Scales', 2), ('NI_Scale[1]_Scale_Type', 'Linear'), ('NI_Scale[1]_Linear_Slope', 2.6226045264365987e-09), ('NI_Scale[1]_Linear_Y_Intercept', 0.0), ('NI_Scale[1]_Linear_Input_Source', 0)])
OrderedDict([('NI_Scaling_Status', 'unscaled'), ('NI_Number_Of_Scales', 2), ('NI_Scale[1]_Scale_Type', 'Linear'), ('NI_Scale[1]_Linear_Slope', 2.6226045264365987e-09), ('NI_Scale[1]_Linear_Y_Intercept', 0.0), ('NI_Scale[1]_Linear_Input_Source', 0)])
OrderedDict([('NI_Scaling_Status', 'unscaled'), ('NI_Number_Of_Scales', 2), ('NI_Scale[1]_Scale_Type', 'Linear'), ('NI_Scale[1]_Linear_Slope', 2.6226045264365987e-09), ('NI_Scale[1]_Linear_Y_Intercept', 0.0), ('NI_Scale[1]_Linear_Input_Source', 0)])
OrderedDict([('NI_Scaling_Status', 'unscaled'), ('NI_Number_Of_Scales', 2), ('NI_Scale[1]_Scale_Type', 'Linear'), ('NI_Scale[1]_Linear_Slope', 2.6226045264365987e-09), ('NI_Scale[1]_Linear_Y_Intercept', 0.0), ('NI_Scale[1]_Linear_Input_Source', 0)])
OrderedDict([('NI_Scaling_Status', 'unscaled'), ('NI_Number_Of_Scales', 2), ('NI_Scale[1]_Scale_Type', 'Linear'), ('NI_Scale[1]_Linear_Slope', 2.6226045264365987e-09), ('NI_Scale[1]_Linear_Y_Intercept', 0.0), ('NI_Scale[1]_Linear_Input_Source', 0)])
...
01-22-2023 10:02 PM
The t0 and dt are the metadata of the channel properties. If you open the TDMS file with Excel, you can see t0 & dt and data are on two different worksheets. For more details, NI TDMS File Format - What is a TDMS File?
I have attached an example to read the TDMS file.