Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 55b7991

Browse files
author
Antonio Ulloa
committed
New visualization scripts using MNE and Pysurfer
1 parent 6e6f505 commit 55b7991

File tree

137 files changed

+772819
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+772819
-318
lines changed

.DS_Store

0 Bytes
Binary file not shown.

analysis/compute_BOLD_balloon_66_regions.py

Lines changed: 394 additions & 169 deletions
Large diffs are not rendered by default.

analysis/compute_avg_MIs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#mpl.style.use('ggplot')
6161

6262
# increase font size prior to plotting
63-
plt.rcParams.update({'font.size': 15})
63+
plt.rcParams.update({'font.size': 20})
6464

6565
# define number of groups to plot
6666
N = 10

analysis/compute_avg_NAI_auditory.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# This file (compute_avg_NAI_auditory.py) was created on April 19, 2016.
3737
#
3838
#
39-
# Author: Antonio Ulloa. Last updated by Antonio Ulloa on April 19, 2016
39+
# Author: Antonio Ulloa. Last updated by Antonio Ulloa on October 25, 2016
4040
# **************************************************************************/
4141

4242
# compute_avg_NAI_auditory.py
@@ -50,6 +50,9 @@
5050
num_of_subjects = 10
5151
NAI_ts_length = 30
5252

53+
# increase font size prior to plotting
54+
plt.rcParams.update({'font.size': 20})
55+
5356
# define the names of the input files where the NAI timecourses are contained, for four conditions:
5457
# TC-PSL, Tones-PSL, TC-DMS and Tones-DMS
5558
NAI_TC_PSL_subj = np.array(['subject_original_with_feedback/output.TC_PSL/NAI_timecourse.npy',
@@ -123,44 +126,54 @@
123126
# Set up figure to plot MEG source dynamics averaged across trials
124127
fig = plt.figure(1)
125128

126-
plt.suptitle('NAI average timecourse during TC DMS')
129+
plt.suptitle('TC DMS')
127130

128131
# Plot NAI
129132
aud_plot_S1 = plt.plot(NAI_TC_DMS_avg[0], label='S1')
130133
aud_plot_S2 = plt.plot(NAI_TC_DMS_avg[1], label='S2')
131134

132135
plt.legend()
136+
plt.ylabel('Neural Activity')
137+
plt.xlabel('Simulation timesteps')
133138

134139
# Set up figure to plot MEG source dynamics averaged across trials
135140
fig = plt.figure(2)
136141

137-
plt.suptitle('NAI average timecourse during Tones DMS')
142+
plt.suptitle('Tones DMS')
138143

139144
# Plot NAI
140145
aud_plot_S1 = plt.plot(NAI_Tones_DMS_avg[0], label='S1')
141146
aud_plot_S2 = plt.plot(NAI_Tones_DMS_avg[1], label='S2')
142147

143148
plt.legend()
149+
plt.ylabel('Neural Activity')
150+
plt.xlabel('Simulation timesteps')
151+
144152
# Set up figure to plot MEG source dynamics averaged across trials
145153
fig = plt.figure(3)
146154

147-
plt.suptitle('NAI average timecourse during TC PSL')
155+
plt.suptitle('TC PSL')
148156

149157
# Plot NAI
150158
aud_plot_S1 = plt.plot(NAI_TC_PSL_avg[0], label='S1')
151159
aud_plot_S2 = plt.plot(NAI_TC_PSL_avg[1], label='S2')
152160

153161
plt.legend()
162+
plt.ylabel('Neural Activity Index')
163+
plt.xlabel('Simulation timesteps')
164+
154165
# Set up figure to plot MEG source dynamics averaged across trials
155166
fig = plt.figure(4)
156167

157-
plt.suptitle('NAI average timecourse during Tones PSL')
168+
plt.suptitle('Tones PSL')
158169

159170
# Plot NAI
160171
aud_plot_S1 = plt.plot(NAI_Tones_PSL_avg[0], label='S1')
161172
aud_plot_S2 = plt.plot(NAI_Tones_PSL_avg[1], label='S2')
162173

163174
plt.legend()
175+
plt.ylabel('Neural Activity')
176+
plt.xlabel('Simulation timesteps')
164177

165178
# Show the plot on the screen
166179
plt.show()

analysis/compute_syn_visual_66_regions.py

Lines changed: 51 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -69,78 +69,65 @@
6969

7070
# the following ranges define the location of the nodes within a given ROI in Hagmann's brain.
7171
# They were taken from the excel document:
72-
# "Hagmann's Talairach Coordinates (obtained from TVB).xlsx"
72+
# "Location of visual LSNM modules within Connectome.xlsx"
7373
# Extracted from The Virtual Brain Demo Data Sets
74-
# Please note that arrays in Python start from zero so one does need to account for that and shift
75-
# indices given by the above document by one location.
76-
# Use 6 nodes within rPCAL including host node 345
77-
v1_loc = range(344, 350) # Hagmann's brain nodes included within V1 ROI
7874

79-
# Use 6 nodes within rFUS including host node 393
80-
v4_loc = range(390, 396) # Hagmann's brain nodes included within V4 ROI
81-
82-
# Use 6 nodes within rPARH including host node 413
83-
it_loc = range(412, 418) # Hagmann's brain nodes included within IT ROI
84-
85-
# Use 6 nodes within rRMF including host node 74
86-
d1_loc = range(73, 79) # Hagmann's brain nodes included within D1 ROI
87-
88-
# Use 6 nodes within rPTRI including host node 41
89-
d2_loc = range(39, 45) # Hagmann's brain nodes included within D2 ROI
90-
91-
# Use 6 nodes within rPOPE including host node 47
92-
fs_loc = range(47, 53) # Hagmann's brain nodes included within FS ROI
93-
94-
# Use 6 nodes within rCMF including host node 125
95-
fr_loc = range(125, 131) # Hagmann's brain nodes included within FR ROI
96-
97-
# Use 6 nodes within lPARH
98-
lit_loc= range(911, 917) # Hagmann's brain nodes included within left IT ROI
75+
roi_dict = {
76+
'rLOF' : range( 0, 19),
77+
'rPORB' : range( 19, 25),
78+
'rFP' : range( 25, 27),
79+
'rMOF' : range( 27, 39),
80+
'rPTRI' : range( 39, 47),
81+
'rPOPE' : range( 47, 57),
82+
'rRMF' : range( 57, 79),
83+
'rSF' : range( 79, 125),
84+
'rCMF' : range(125, 138),
85+
'rPREC' : range(138, 174),
86+
'rPARC' : range(174, 186),
87+
'rRAC' : range(186, 190),
88+
'rCAC' : range(190, 194),
89+
'rPC' : range(194, 201),
90+
'rISTC' : range(201, 209),
91+
'rPSTC' : range(209, 240),
92+
'rSMAR' : range(240, 256),
93+
'rSP' : range(256, 283),
94+
'rIP' : range(283, 311),
95+
'rPCUN' : range(311, 334),
96+
'rCUN' : range(334, 344),
97+
'rPCAL' : range(344, 354),
98+
'rLOCC' : range(354, 373),
99+
'rLING' : range(373, 390),
100+
'rFUS' : range(390, 412),
101+
'rPARH' : range(412, 418),
102+
'rENT' : range(418, 420),
103+
'rTP' : range(420, 423),
104+
'rIT' : range(423, 442),
105+
'rMT' : range(442, 462),
106+
'rBSTS' : range(462, 469),
107+
'rST' : range(469, 497),
108+
'rTT' : range(497, 500)
109+
}
99110

100111
# Load TVB nodes synaptic activity
101112
tvb_synaptic = np.load("tvb_abs_syn.npy")
102113

103-
# Load TVB host node synaptic activities into separate numpy arrays
104-
tvb_ev1 = tvb_synaptic[:, 0, v1_loc[0]:v1_loc[-1]+1, 0]
105-
tvb_ev4 = tvb_synaptic[:, 0, v4_loc[0]:v4_loc[-1]+1, 0]
106-
tvb_eit = tvb_synaptic[:, 0, it_loc[0]:it_loc[-1]+1, 0]
107-
tvb_ed1 = tvb_synaptic[:, 0, d1_loc[0]:d1_loc[-1]+1, 0]
108-
tvb_ed2 = tvb_synaptic[:, 0, d2_loc[0]:d2_loc[-1]+1, 0]
109-
tvb_efs = tvb_synaptic[:, 0, fs_loc[0]:fs_loc[-1]+1, 0]
110-
tvb_efr = tvb_synaptic[:, 0, fr_loc[0]:fr_loc[-1]+1, 0]
111-
tvb_iv1 = tvb_synaptic[:, 1, v1_loc[0]:v1_loc[-1]+1, 0]
112-
tvb_iv4 = tvb_synaptic[:, 1, v4_loc[0]:v4_loc[-1]+1, 0]
113-
tvb_iit = tvb_synaptic[:, 1, it_loc[0]:it_loc[-1]+1, 0]
114-
tvb_id1 = tvb_synaptic[:, 1, d1_loc[0]:d1_loc[-1]+1, 0]
115-
tvb_id2 = tvb_synaptic[:, 1, d2_loc[0]:d2_loc[-1]+1, 0]
116-
tvb_ifs = tvb_synaptic[:, 1, fs_loc[0]:fs_loc[-1]+1, 0]
117-
tvb_ifr = tvb_synaptic[:, 1, fr_loc[0]:fr_loc[-1]+1, 0]
118-
119-
# now extract synaptic activity in the contralateral IT
120-
tvb_elit = tvb_synaptic[:, 0, lit_loc[0]:lit_loc[-1]+1, 0]
121-
tvb_ilit = tvb_synaptic[:, 1, lit_loc[0]:lit_loc[-1]+1, 0]
122-
123-
# add all units WITHIN each region together across space to calculate
124-
# synaptic activity in EACH brain region
125-
v1_syn = np.sum(tvb_ev1+tvb_iv1, axis=1)
126-
v4_syn = np.sum(tvb_ev4+tvb_iv4, axis=1)
127-
it_syn = np.sum(tvb_eit+tvb_iit, axis=1)
128-
d1_syn = np.sum(tvb_ed1+tvb_id1, axis=1)
129-
d2_syn = np.sum(tvb_ed2+tvb_id2, axis=1)
130-
fs_syn = np.sum(tvb_efs+tvb_ifs, axis=1)
131-
fr_syn = np.sum(tvb_efr+tvb_ifr, axis=1)
132-
133-
# now, add unit across space in the contralateral IT
134-
lit_syn = np.sum(tvb_elit + tvb_ilit, axis=1)
135-
136-
# create a numpy array of timeseries
137-
synaptic = np.array([v1_syn, v4_syn, it_syn, fs_syn, d1_syn, d2_syn, fr_syn, lit_syn])
114+
# create a numpy array of synaptic time-series, with a number of elements defined
115+
# by the number of ROIs above and the number of time points in each synaptic time-series
116+
synaptic = np.empty([len(roi_dict), tvb_synaptic.shape[0]])
138117

118+
# Load TVB host node synaptic activities into separate numpy arrays
119+
idx=0
120+
for roi in roi_dict:
121+
synaptic[idx] = np.sum(tvb_synaptic[:, 0, roi_dict[roi], 0] + # excitatory unit of ROI
122+
tvb_synaptic[:, 1, roi_dict[roi], 0], # inhibitory unit of ROI
123+
axis=1)
124+
idx = idx + 1
125+
139126
# now, save all synaptic timeseries to a single file
140127
np.save(syn_file, synaptic)
141128

142-
# Extract number of timesteps from one of the matrices
143-
timesteps = v1_syn.shape[0]
129+
# Extract total number of timesteps from synaptic time-series
130+
timesteps = tvb_synaptic.shape[0]
144131
print 'Timesteps = ', timesteps
145132

146133
# Construct a numpy array of timesteps (data points provided in data file)
@@ -156,36 +143,8 @@
156143

157144
# Set up figures to plot synaptic activity
158145
plt.figure()
159-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN V1')
160-
plt.plot(t, v1_syn)
161-
# Set up figures to plot synaptic activity
162-
plt.figure()
163-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN V4')
164-
plt.plot(v4_syn)
165-
# Set up figures to plot synaptic activity
166-
plt.figure()
167-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN IT')
168-
plt.plot(it_syn)
169-
# Set up figures to plot synaptic activity
170-
plt.figure()
171-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN FS')
172-
plt.plot(fs_syn)
173-
# Set up figures to plot synaptic activity
174-
plt.figure()
175-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN D1')
176-
plt.plot(d1_syn)
177-
# Set up figures to plot synaptic activity
178-
plt.figure()
179-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN D2')
180-
plt.plot(d2_syn)
181-
# Set up figures to plot synaptic activity
182-
plt.figure()
183-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN FR')
184-
plt.plot(fr_syn)
185-
# Set up figures to plot synaptic activity
186-
plt.figure()
187-
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY IN LEFT IT')
188-
plt.plot(lit_syn)
146+
plt.suptitle('SIMULATED SYNAPTIC ACTIVITY OF ONE ROI')
147+
plt.plot(t, synaptic[0])
189148

190149
# Show the plots on the screen
191150
plt.show()

0 commit comments

Comments
 (0)