def test_make_grid_layout(): """ Test creation of grid layout """ tmp_name = 'bar' lout_name = 'test_ica' lout_orig = read_layout(kind=lout_name, path=lout_path) layout = make_grid_layout(test_info) layout.save(op.join(tempdir, tmp_name + '.lout')) lout_new = read_layout(kind=tmp_name, path=tempdir) assert_array_equal(lout_new.kind, tmp_name) assert_array_equal(lout_orig.pos, lout_new.pos) assert_array_equal(lout_orig.names, lout_new.names)
def test_make_grid_layout(): """ Test creation of grid layout """ tmp_name = 'bar' lout_name = 'test_ica' lout_orig = read_layout(kind=lout_name, path=lout_path) layout = make_grid_layout(test_info) layout.save(op.join(tempdir, tmp_name + '.lout')) lout_new = read_layout(kind=tmp_name, path=tempdir) assert_array_equal(lout_new.kind, tmp_name) assert_array_equal(lout_orig.pos, lout_new.pos) assert_array_equal(lout_orig.names, lout_new.names) # Test creating grid layout with specified number of columns layout = make_grid_layout(test_info, n_col=2) # Vertical positions should be equal assert_true(layout.pos[0, 1] == layout.pos[1, 1]) # Horizontal positions should be unequal assert_true(layout.pos[0, 0] != layout.pos[1, 0]) # Box sizes should be equal assert_array_equal(layout.pos[0, 3:], layout.pos[1, 3:])
def test_make_grid_layout(): """ Test creation of grid layout """ tempdir = _TempDir() tmp_name = 'bar' lout_name = 'test_ica' lout_orig = read_layout(kind=lout_name, path=lout_path) layout = make_grid_layout(test_info) layout.save(op.join(tempdir, tmp_name + '.lout')) lout_new = read_layout(kind=tmp_name, path=tempdir) assert_array_equal(lout_new.kind, tmp_name) assert_array_equal(lout_orig.pos, lout_new.pos) assert_array_equal(lout_orig.names, lout_new.names) # Test creating grid layout with specified number of columns layout = make_grid_layout(test_info, n_col=2) # Vertical positions should be equal assert_true(layout.pos[0, 1] == layout.pos[1, 1]) # Horizontal positions should be unequal assert_true(layout.pos[0, 0] != layout.pos[1, 0]) # Box sizes should be equal assert_array_equal(layout.pos[0, 3:], layout.pos[1, 3:])
plt.figure() plt.plot(times, data_clean[affected_idx], color='k') plt.title('Affected channel MEG 1531 after cleaning.') plt.ylim(y0, y1) plt.show() ############################################################################### # Export ICA as raw for subsequent processing steps in ICA space. from mne.layouts import make_grid_layout ica_raw = ica.sources_as_raw(raw, start=100., stop=160., picks=None) print ica_raw.ch_names[:5] # just a few ica_lout = make_grid_layout(ica_raw.info) # Uncomment the following two lines to save sources and layout. # ica_raw.save('ica_raw.fif') # ica_lout.save(os.path.join(os.environ['HOME'], '.mne/lout/ica.lout')) ############################################################################### # To save an ICA session you can say: # ica.save('my_ica.fif') # # You can later restore the session by saying: # >>> from mne.preprocessing import read_ica # >>> read_ica('my_ica.fif') # # The ICA functionality exposed in this example will then be available at # at any later point in time provided the data have the same structure as the