@verbose
def corrmap(icas, template, threshold="auto", label=None, ch_type="eeg",
            plot=True, show=True, verbose=None, outlines='head', layout=None,
            sensors=True, contours=6, cmap=None):
    if not isinstance(plot, bool):
        raise ValueError("`plot` must be of type `bool`")

    if threshold == 'auto':
        threshold = np.arange(60, 95, dtype=np.float64) / 100.

    all_maps = [_get_ica_map(ica) for ica in icas]

    # check if template is an index to one IC in one ICA object, or an array
    if len(template) == 2:
        target = all_maps[template[0]][template[1]]
        is_subject = True
    elif template.ndim == 1 and len(template) == all_maps[0].shape[1]:
        target = template
        is_subject = False
    else:
        raise ValueError("`template` must be a length-2 tuple or an array the "
                         "size of the ICA maps.")

    template_fig, labelled_ics = None, None
    if plot is True:
        if is_subject:  # plotting from an ICA object
            ttl = 'Template from subj. {0}'.format(str(template[0]))
            template_fig = icas[template[0]].plot_components(
                picks=template[1], ch_type=ch_type, title=ttl,
                outlines=outlines, cmap=cmap, contours=contours, layout=layout,
                show=show)
        else:  # plotting an array
            template_fig = _plot_corrmap([template], [0], [0], ch_type,
                                         icas[0].copy(), "Template",
                                         outlines=outlines, cmap=cmap,
                                         contours=contours, layout=layout,
                                         show=show, template=True)
        template_fig.subplots_adjust(top=0.8)
        template_fig.canvas.draw()

    # first run: use user-selected map
    if isinstance(threshold, (int, float)):
        if len(all_maps) == 0:
            logger.info('No component detected using find_outliers.'
                        ' Consider using threshold="auto"')
            return icas
        nt, mt, s, mx = _find_max_corrs(all_maps, target, threshold)
    elif len(threshold) > 1:
        paths = [_find_max_corrs(all_maps, target, t) for t in threshold]
        # find iteration with highest avg correlation with target
        nt, mt, s, mx = paths[np.argmax([path[2] for path in paths])]

    # second run: use output from first run
    if isinstance(threshold, (int, float)):
        if len(all_maps) == 0 or len(nt) == 0:
            if threshold > 1:
                logger.info('No component detected using find_outliers. '
                            'Consider using threshold="auto"')
            return icas
        nt, mt, s, mx = _find_max_corrs(all_maps, nt, threshold)
    elif len(threshold) > 1:
        paths = [_find_max_corrs(all_maps, nt, t) for t in threshold]
        # find iteration with highest avg correlation with target
        nt, mt, s, mx = paths[np.argmax([path[1] for path in paths])]

    allmaps, indices, subjs, nones = [list() for _ in range(4)]
    logger.info('Median correlation with constructed map: %0.3f' % mt)
    if plot is True:
        logger.info('Displaying selected ICs per subject.')

    for ii, (ica, max_corr) in enumerate(zip(icas, mx)):
        if (label is not None) and (not hasattr(ica, 'labels_')):
            ica.labels_ = dict()
        if len(max_corr) > 0:
            if isinstance(max_corr[0], np.ndarray):
                max_corr = max_corr[0]
            if label is not None:
                ica.labels_[label] = list(set(list(max_corr) +
                                          ica.labels_.get(label, list())))
            if plot is True:
                allmaps.extend(_get_ica_map(ica, components=max_corr))
                subjs.extend([ii] * len(max_corr))
                indices.extend(max_corr)
        else:
            if (label is not None) and (label not in ica.labels_):
                ica.labels_[label] = list()
            nones.append(ii)

    if len(nones) == 0:
        logger.info('At least 1 IC detected for each subject.')
    else:
        logger.info('No maps selected for subject(s) ' +
                    ', '.join([str(x) for x in nones]) +
                    ', consider a more liberal threshold.')

    if plot is True:
        labelled_ics = _plot_corrmap(allmaps, subjs, indices, ch_type, ica,
                                     label, outlines=outlines, cmap=cmap,
                                     contours=contours, layout=layout,
                                     show=show)
        return template_fig, labelled_ics
    else:
        return None
The valid tests are from greek tax numbers (AFMs) found on the internet
dataset/ETHPy150Open mne-tools/mne-python/mne/preprocessing/ica.py/corrmap--crossover with--dataset/ETHPy150Open django/django-localflavor/tests/test_gr.py/GRLocalFlavorTests.test_GRTaxNumberField