

def plot_psds_topomap(psds, freqs, pos, agg_fun=None, vmin=None, vmax=None, bands=None, cmap='RdBu_r', dB=True, normalize=False, cbar_fmt='%0.3f', outlines='head', show=True):
    "Plot spatial maps of PSDs\n\n    Parameters\n    ----------\n    psds : np.ndarray of float, shape (n_channels, n_freqs)\n        Power spectral densities\n    freqs : np.ndarray of float, shape (n_freqs)\n        Frequencies used to compute psds.\n    pos : numpy.ndarray of float, shape (n_sensors, 2)\n        The positions of the sensors.\n    agg_fun : callable\n        The function used to aggregate over frequencies.\n        Defaults to np.sum. if normalize is True, else np.mean.\n    vmin : float | callable | None\n        The value specifying the lower bound of the color range.\n        If None np.min(data) is used. If callable, the output equals\n        vmin(data).\n    vmax : float | callable | None\n        The value specifying the upper bound of the color range.\n        If None, the maximum absolute value is used. If callable, the output\n        equals vmax(data). Defaults to None.\n    bands : list of tuple | None\n        The lower and upper frequency and the name for that band. If None,\n        (default) expands to:\n\n            bands = [(0, 4, 'Delta'), (4, 8, 'Theta'), (8, 12, 'Alpha'),\n                     (12, 30, 'Beta'), (30, 45, 'Gamma')]\n\n    cmap : matplotlib colormap\n        Colormap. For magnetometers and eeg defaults to 'RdBu_r', else\n        'Reds'.\n    dB : bool\n        If True, transform data to decibels (with ``10 * np.log10(data)``)\n        following the application of `agg_fun`. Only valid if normalize is\n        False.\n    normalize : bool\n        If True, each band will be divided by the total power. Defaults to\n        False.\n    cbar_fmt : str\n        The colorbar format. Defaults to '%0.3f'.\n    outlines : 'head' | 'skirt' | dict | None\n        The outlines to be drawn. If 'head', the default head scheme will be\n        drawn. If 'skirt' the head scheme will be drawn, but sensors are\n        allowed to be plotted outside of the head circle. If dict, each key\n        refers to a tuple of x and y positions, the values in 'mask_pos' will\n        serve as image mask, and the 'autoshrink' (bool) field will trigger\n        automated shrinking of the positions due to points outside the outline.\n        Alternatively, a matplotlib patch object can be passed for advanced\n        masking options, either directly or as a function that returns patches\n        (required for multi-axis plots). If None, nothing will be drawn.\n        Defaults to 'head'.\n    show : bool\n        Show figure if True.\n\n    Returns\n    -------\n    fig : instance of matplotlib figure\n        Figure distributing one image per channel across sensor topography.\n    "
    import matplotlib.pyplot as plt
    if (bands is None):
        bands = [(0, 4, 'Delta'), (4, 8, 'Theta'), (8, 12, 'Alpha'), (12, 30, 'Beta'), (30, 45, 'Gamma')]
    if (agg_fun is None):
        agg_fun = (np.sum if (normalize is True) else np.mean)
    if (normalize is True):
        psds /= data.sum(axis=(- 1))[(..., None)]
        assert np.allclose(psds.sum(axis=(- 1)), 1.0)
    n_axes = len(bands)
    (fig, axes) = plt.subplots(1, n_axes, figsize=((2 * n_axes), 1.5))
    if (n_axes == 1):
        axes = [axes]
    for (ax, (fmin, fmax, title)) in zip(axes, bands):
        freq_mask = ((fmin < freqs) & (freqs < fmax))
        if (freq_mask.sum() == 0):
            raise RuntimeError(('No frequencies in band "%s" (%s, %s)' % (title, fmin, fmax)))
        data = agg_fun(psds[:, freq_mask], axis=1)
        if ((dB is True) and (normalize is False)):
            data = (10 * np.log10(data))
            unit = 'dB'
        else:
            unit = 'power'
        _plot_topomap_multi_cbar(data, pos, ax, title=title, vmin=vmin, vmax=vmax, cmap=cmap, colorbar=True, unit=unit, cbar_fmt=cbar_fmt)
    tight_layout(fig=fig)
    fig.canvas.draw()
    plt_show(show)
    return fig

dataset/ETHPy150Open mne-tools/mne-python/mne/viz/topomap.py plot_psds_topomap/VarMisuse@156/1233 `psds`->`data`