def test_link_brains(renderer_interactive): """Test plotting linked brains.""" sample_src = read_source_spaces(src_fname) vertices = [s['vertno'] for s in sample_src] n_time = 5 n_verts = sum(len(v) for v in vertices) stc_data = np.zeros((n_verts * n_time)) stc_size = stc_data.size stc_data[(np.random.rand(stc_size // 20) * stc_size).astype(int)] = \ np.random.RandomState(0).rand(stc_data.size // 20) stc_data.shape = (n_verts, n_time) stc = SourceEstimate(stc_data, vertices, 1, 1) colormap = 'mne_analyze' brain = plot_source_estimates(stc, 'sample', colormap=colormap, background=(1, 1, 0), subjects_dir=subjects_dir, colorbar=True, clim='auto') if renderer_interactive._get_3d_backend() == 'mayavi': with pytest.raises(NotImplementedError, match='backend is pyvistaqt'): link_brains(brain) else: with pytest.raises(ValueError, match='is empty'): link_brains([]) with pytest.raises(TypeError, match='type is Brain'): link_brains('foo') link_brains(brain, time=True, camera=True)
def test_link_brains(renderer): """Test plotting linked brains.""" if renderer.get_3d_backend() == "mayavi": pytest.skip() # Skip PySurfer.TimeViewer else: # Disable testing to allow interactive window renderer.MNE_3D_BACKEND_TESTING = False with pytest.raises(ValueError, match='is empty'): link_brains([]) with pytest.raises(TypeError, match='type is Brain'): link_brains('foo') sample_src = read_source_spaces(src_fname) vertices = [s['vertno'] for s in sample_src] n_time = 5 n_verts = sum(len(v) for v in vertices) stc_data = np.zeros((n_verts * n_time)) stc_size = stc_data.size stc_data[(np.random.rand(stc_size // 20) * stc_size).astype(int)] = \ np.random.RandomState(0).rand(stc_data.size // 20) stc_data.shape = (n_verts, n_time) stc = SourceEstimate(stc_data, vertices, 1, 1) colormap = 'mne_analyze' brain = plot_source_estimates(stc, 'sample', colormap=colormap, background=(1, 1, 0), subjects_dir=subjects_dir, colorbar=True, clim='auto') link_brains(brain)