def test_mixed_stc(): """Test source estimate from mixed source space.""" N = 90 # number of sources T = 2 # number of time points S = 3 # number of source spaces data = rng.randn(N, T) vertno = S * [np.arange(N // S)] # make sure error is raised if vertices are not a list of length >= 2 pytest.raises(ValueError, MixedSourceEstimate, data=data, vertices=[np.arange(N)]) stc = MixedSourceEstimate(data, vertno, 0, 1) vol = read_source_spaces(fname_vsrc) # make sure error is raised for plotting surface with volume source pytest.raises(ValueError, stc.plot_surface, src=vol) tempdir = _TempDir() fname = op.join(tempdir, 'mixed-stc.h5') stc.save(fname) stc_out = read_source_estimate(fname) assert_array_equal(stc_out.vertices, vertno) assert_array_equal(stc_out.data, data) assert stc_out.tmin == 0 assert stc_out.tstep == 1 assert isinstance(stc_out, MixedSourceEstimate)
def test_mixed_stc(): """Test source estimate from mixed source space.""" N = 90 # number of sources T = 2 # number of time points S = 3 # number of source spaces data = rng.randn(N, T) vertno = S * [np.arange(N // S)] # make sure error is raised if vertices are not a list of length >= 2 pytest.raises(ValueError, MixedSourceEstimate, data=data, vertices=[np.arange(N)]) stc = MixedSourceEstimate(data, vertno, 0, 1) vol = read_source_spaces(fname_vsrc) # make sure error is raised for plotting surface with volume source pytest.raises(ValueError, stc.plot_surface, src=vol) tempdir = _TempDir() fname = op.join(tempdir, 'mixed-stc.h5') stc.save(fname) stc_out = read_source_estimate(fname) assert_array_equal(stc_out.vertices, vertno) assert_array_equal(stc_out.data, data) assert stc_out.tmin == 0 assert stc_out.tstep == 1 assert isinstance(stc_out, MixedSourceEstimate)
def test_mixed_sources_plot_surface(): """Test plot_surface() for mixed source space.""" src = read_source_spaces(fwd_fname2) N = np.sum([s['nuse'] for s in src]) # number of sources T = 2 # number of time points S = 3 # number of source spaces rng = np.random.RandomState(0) data = rng.randn(N, T) vertno = S * [np.arange(N // S)] stc = MixedSourceEstimate(data, vertno, 0, 1) stc.plot_surface(views='lat', hemi='split', src=src, subject='fsaverage', subjects_dir=subjects_dir, colorbar=False)
def test_mixed_sources_plot_surface(renderer_interactive): """Test plot_surface() for mixed source space.""" _check_skip_pysurfer(renderer_interactive) src = read_source_spaces(fwd_fname2) N = np.sum([s['nuse'] for s in src]) # number of sources T = 2 # number of time points S = 3 # number of source spaces rng = np.random.RandomState(0) data = rng.randn(N, T) vertno = S * [np.arange(N // S)] stc = MixedSourceEstimate(data, vertno, 0, 1) brain = stc.surface().plot(views='lat', hemi='split', subject='fsaverage', subjects_dir=subjects_dir, colorbar=False) brain.close() del brain
def test_mixed_stc(): """Test source estimate from mixed source space """ N = 90 # number of sources T = 2 # number of time points S = 3 # number of source spaces data = rng.randn(N, T) vertno = S * [np.arange(N // S)] # make sure error is raised if vertices are not a list of length >= 2 assert_raises(ValueError, MixedSourceEstimate, data=data, vertices=[np.arange(N)]) stc = MixedSourceEstimate(data, vertno, 0, 1) vol = read_source_spaces(fname_vsrc) # make sure error is raised for plotting surface with volume source assert_raises(ValueError, stc.plot_surface, src=vol)