<commit_before>import os.path as op
import numpy as np

from mne import fiff, read_events, Epochs
from mne.layouts import read_layout
from mne.viz import plot_topo


base_dir = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data')
fname = op.join(base_dir, 'test-ave.fif')
raw_fname = op.join(base_dir, 'test_raw.fif')
event_name = op.join(base_dir, 'test-eve.fif')
event_id, tmin, tmax = 1, -0.2, 0.5

raw = fiff.Raw(raw_fname, preload=True)
events = read_events(event_name)
picks = fiff.pick_types(raw.info, meg=True, eeg=False, stim=False,
                        ecg=False, eog=False)
# Use a subset of channels for plotting speed
picks = np.round(np.linspace(0, len(picks) + 1, 50)).astype(int)
epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks,
                baseline=(None, 0))
evoked = epochs.average()

def test_plot_topo():
    """Test plotting of ERP topography
    """

    layout = read_layout('Vectorview-all')<commit_msg>use Agg backend in test_viz<commit_after>import os.path as op
import numpy as np

from mne import fiff, read_events, Epochs
from mne.layouts import read_layout
from mne.viz import plot_topo

import matplotlib
matplotlib.use('Agg')  # for testing don't use X server

base_dir = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data')
fname = op.join(base_dir, 'test-ave.fif')
raw_fname = op.join(base_dir, 'test_raw.fif')
event_name = op.join(base_dir, 'test-eve.fif')
event_id, tmin, tmax = 1, -0.2, 0.5

raw = fiff.Raw(raw_fname, preload=True)
events = read_events(event_name)
picks = fiff.pick_types(raw.info, meg=True, eeg=False, stim=False,
                        ecg=False, eog=False)
# Use a subset of channels for plotting speed
picks = np.round(np.linspace(0, len(picks) + 1, 50)).astype(int)
epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks,
                baseline=(None, 0))
evoked = epochs.average()


def test_plot_topo():
    """Test plotting of ERP topography
    """
    layout = read_layout('Vectorview-all')
{'fraction_non_alphanumeric': 0.13922155688622753, 'fraction_numerical': 0.00998003992015968, 'mean_word_length': 4.154241645244216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5964367', 'n_tokens_mistral': 778, 'n_tokens_neox': 749, 'n_words': 186}