@verbose
def read_ctf_comp(fid, node, chs, verbose=None):
    compdata = []
    comps = dir_tree_find(node, FIFF.FIFFB_MNE_CTF_COMP_DATA)

    for node in comps:
        #   Read the data we need
        mat = _read_named_matrix(fid, node, FIFF.FIFF_MNE_CTF_COMP_DATA)
        for p in range(node['nent']):
            kind = node['directory'][p].kind
            pos = node['directory'][p].pos
            if kind == FIFF.FIFF_MNE_CTF_COMP_KIND:
                tag = read_tag(fid, pos)
                break
        else:
            raise Exception('Compensation type not found')

        #   Get the compensation kind and map it to a simple number
        one = dict(ctfkind=tag.data)
        del tag
        _add_kind(one)
        for p in range(node['nent']):
            kind = node['directory'][p].kind
            pos = node['directory'][p].pos
            if kind == FIFF.FIFF_MNE_CTF_COMP_CALIBRATED:
                tag = read_tag(fid, pos)
                calibrated = tag.data
                break
        else:
            calibrated = False

        one['save_calibrated'] = bool(calibrated)
        one['data'] = mat
        if not calibrated:
            #   Calibrate...
            _calibrate_comp(one, chs, mat['row_names'], mat['col_names'])
        else:
            one['rowcals'] = np.ones(mat['data'].shape[0], dtype=np.float)
            one['colcals'] = np.ones(mat['data'].shape[1], dtype=np.float)

        compdata.append(one)

    if len(compdata) > 0:
        logger.info('    Read %d compensation matrices' % len(compdata))

    return compdata


###############################################################################
# Writing
Read the CTF software compensation data from the given node
dataset/ETHPy150Open mne-tools/mne-python/mne/io/ctf_comp.py/read_ctf_comp