subcortex2 = np.genfromtxt( env.data + '/structural/thalamusR_SA_ADHD_10to21_MATCHscript.csv', delimiter=',') # removing first column and first row, because they're headers subcortex2 = scipy.delete(subcortex2, 0, 1) subcortex2 = scipy.delete(subcortex2, 0, 0) # format it to be subjects x variables subcortex2 = subcortex2.T # selecting only a few vertices in the thalamus # my_sub_vertices = [2310, 1574, 1692, 1262, 1350] # Philip's # my_sub_vertices = range(0, subcortex.shape[1], 100) # every 100 # my_sub_vertices = range(subcortex.shape[1]) w = mne.read_w(env.fsl + '/mni/bem/cortex-3-rh.w') my_cor_vertices = w['vertices'] # w = mne.read_w(env.fsl + '/mni/bem/thalamus-10-rh.w') # my_sub_vertices = w['vertices'] # my_cor_vertices = range(0, cortex.shape[1], 20) # my_sub_vertices = [2034, 950, 216, 52, 2276, 2893, 1386, 1922, 2187, 1831, 1828] # GS made it up by looking at anamoty, refer to Evernote for details. WRONG! # my_sub_vertices = [1533, 1106, 225, 163, 2420, 2966, 1393, 1666, 1681, 1834, 2067] # GS made it up by looking at anamoty, refer to Evernote for details my_sub_vertices = [] # in nice order from anterior to posterior in the cortex (cingulate is last) label_names = [ 'medialdorsal', 'va', 'vl', 'vp', 'lateraldorsal', 'lateralposterior', 'pulvinar', 'anteriornuclei' ] label_names = ['medialdorsal', 'va', 'vl', 'vp', 'pulvinar', 'anteriornuclei']
def test_sensitivity_maps(): """Test sensitivity map computation""" fwd = mne.read_forward_solution(fwd_fname, surf_ori=True) projs = None proj_eog = read_proj(eog_fname) decim = 6 for ch_type in ['eeg', 'grad', 'mag']: w_lh = mne.read_w(sensmap_fname % (ch_type, 'lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, 'rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=projs, ch_type=ch_type, mode='free', exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim) assert_true(stc.subject == 'sample') # let's just make sure the others run if ch_type == 'grad': # fixed w_lh = mne.read_w(sensmap_fname % (ch_type, '2-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '2-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=projs, mode='fixed', ch_type=ch_type, exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim) if ch_type == 'mag': # ratio w_lh = mne.read_w(sensmap_fname % (ch_type, '3-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '3-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=projs, mode='ratio', ch_type=ch_type, exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim) if ch_type == 'eeg': # radiality (4) w_lh = mne.read_w(sensmap_fname % (ch_type, '4-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '4-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=projs, mode='radiality', ch_type=ch_type, exclude='bads') # angle (5) w_lh = mne.read_w(sensmap_fname % (ch_type, '5-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '5-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=proj_eog, mode='angle', ch_type=ch_type, exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim) # remaining (6) w_lh = mne.read_w(sensmap_fname % (ch_type, '6-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '6-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=proj_eog, mode='remaining', ch_type=ch_type, exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim) # dampening (7) w_lh = mne.read_w(sensmap_fname % (ch_type, '7-lh')) w_rh = mne.read_w(sensmap_fname % (ch_type, '7-rh')) w = np.r_[w_lh['data'], w_rh['data']] stc = sensitivity_map(fwd, projs=proj_eog, mode='dampening', ch_type=ch_type, exclude='bads') assert_array_almost_equal(stc.data.ravel(), w, decim)
# format it to be subjects x variables cortex2 = cortex2.T subcortex2 = np.genfromtxt(env.data + '/structural/thalamusR_SA_ADHD_10to21_MATCHscript.csv', delimiter=',') # removing first column and first row, because they're headers subcortex2 = scipy.delete(subcortex2, 0, 1) subcortex2 = scipy.delete(subcortex2, 0, 0) # format it to be subjects x variables subcortex2 = subcortex2.T # selecting only a few vertices in the thalamus # my_sub_vertices = [2310, 1574, 1692, 1262, 1350] # Philip's # my_sub_vertices = range(0, subcortex.shape[1], 100) # every 100 # my_sub_vertices = range(subcortex.shape[1]) w = mne.read_w(env.fsl + '/mni/bem/cortex-3-rh.w') my_cor_vertices = w['vertices'] # w = mne.read_w(env.fsl + '/mni/bem/thalamus-10-rh.w') # my_sub_vertices = w['vertices'] # my_cor_vertices = range(0, cortex.shape[1], 20) # my_sub_vertices = [2034, 950, 216, 52, 2276, 2893, 1386, 1922, 2187, 1831, 1828] # GS made it up by looking at anamoty, refer to Evernote for details. WRONG! # my_sub_vertices = [1533, 1106, 225, 163, 2420, 2966, 1393, 1666, 1681, 1834, 2067] # GS made it up by looking at anamoty, refer to Evernote for details my_sub_vertices = [] # in nice order from anterior to posterior in the cortex (cingulate is last) label_names = ['medialdorsal', 'va', 'vl', 'vp', 'lateraldorsal', 'lateralposterior', 'pulvinar', 'anteriornuclei'] label_names = ['medialdorsal', 'va', 'vl', 'vp', 'pulvinar', 'anteriornuclei'] for l in label_names: