examples/tdms2fcs.py
def read_tdms(tdms_file):
    """Read tdms file and return channel names and data"""
    tdms_file = nptdms.TdmsFile(tdms_file)
    ch_names = []
    ch_data = []

    for o in tdms_file.objects.values():
        if o.data is not None and len(o.data):
            chn = o.path.split('/')[-1].strip("'")
            if "unit_string" in o.properties:
                unit = o.properties["unit_string"]
                ch_names.append("{} [{}]".format(chn, unit))
            else:
                ch_names.append(chn)

            ch_data.append(o.data)

    return ch_names, ch_data
def read_tdms(tdms_file):
    """Read tdms file and return channel names and data"""
    tdms_file = nptdms.TdmsFile(tdms_file)
    ch_names = []
    ch_data = []

    for o in tdms_file.objects.values():
        if o.data is not None and len(o.data):
            chn = o.path.split('/')[-1].strip("'")
            if "unit_string" in o.properties:
                unit = o.properties["unit_string"]
                ch_names.append("{} [{}]".format(chn, unit))
            else:
                ch_names.append(chn)

            ch_data.append(o.data)

    return ch_names, ch_data
Read tdms file and return channel names and data