def tdmsinfo(file, show_properties=False): tdms_file = TdmsFile.read_metadata(file) level = 0 display('/', level) if show_properties: display_properties(tdms_file, level + 1) for group in tdms_file.groups(): level = 1 display("%s" % group.path, level) if show_properties: display_properties(group, level + 1) for channel in group.channels(): level = 2 display("%s" % channel.path, level) if show_properties: level = 3 if channel.data_type is not None: display("data type: %s" % channel.data_type.__name__, level) display("length: %d" % len(channel), level) display_properties(channel, level)
def load_mdata(self, fns): mdata = {} for i in range(self.prop['Nf']): temp = tdms.read_metadata(self.prop['fns'][i]) mdata[i] = temp.groups()[0] return mdata
#--------------------------------------------------- #--------------------------------------------------- #--------------------------------------------------- # configurations #FILEPATH = "DAQ-sim.tdms" FILENAME = "test_4_DUT_18" FILEPATH = FILENAME + ".tdms" # read in memory whole tdms file tdms_file = TdmsFile.read(FILEPATH) #--------------------------------------------------- #--------------------------------------------------- #--------------------------------------------------- # read data from tdms and put it in dataframe metadata = TdmsFile.read_metadata(FILEPATH) print(metadata.properties) # read properties - all groups, all channels group_list = [] channel_list = [] for group in tdms_file.groups(): group_name = group.name group_list.append(group.name) #print(group_name) for channel in group.channels(): channel_list.append(channel.name) channel_name = channel.name #print(channel_name) # Access dictionary of properties:
def read_metadata_from_start(file): file.seek(0, os.SEEK_SET) return TdmsFile.read_metadata(file)