-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_plotting_tiled_snippets.m
308 lines (296 loc) · 14.8 KB
/
example_plotting_tiled_snippets.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
%EXAMPLE_PLOTTING_TILED_SNIPPETS Example showing how to plot tiled snippet files.
clear; clc;
% Forrest 2022-11-08 NHP stim procedure:
charts.tiled_snippet_arrays("Forrest", 2022, 11, 8, ...
'T', [10 30], ... % Looking at snippets from 10-30 ms after each stim onset
'Type', @(varargin)Snippet_Array_8_8_L_Chart(varargin{:}), ... % We used the 8x8 large grids
'Input_Root', 'R:/NMLShare/generated_data/primate/DARPA_N3/N3_Patch', ... % Saved on raptor
'Output_Figure_Root', 'C:/Users/Max/Box/N3_SharpFocus/Phase 3 experiments/generated_data/Forrest/Forrest_2022_11_08/figures/Interleaved'); % And export to Box
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'T', [10 30], ... % Looking at snippets from 10-30 ms after each stim onset
'Type', @(varargin)Snippet_Array_8_8_L_Chart(varargin{:}), ... % We used the 8x8 large grids
'Input_Root', 'R:/NMLShare/generated_data/primate/DARPA_N3/N3_Patch', ... % Saved on raptor
'Output_Figure_Root', 'C:/Users/Max/Box/N3_SharpFocus/Phase 3 experiments/generated_data/Forrest/Forrest_2022_11_08/figures/Interleaved'); % And export to Box
% % Put the tiled_mean_arrays in a different format for the J_5 / J_10
% "cross" sweeps % %
%% J_5
fig = figure(...
'Name', 'J_5 Cross Sweep (Run24 A)', ...
'Color', 'w',...
'Position',[350 150 875 650]);
L = tiledlayout(fig,3,3);
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 5, ... % This is the center of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 4, ... % This is the lateral part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_x-2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 6, ... % This is the medial part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_x2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 2, ... % This is the anterior part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_y-2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 8, ... % This is the posterior part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_y2mm_-13EMU_Biphasic-Anodal");
ax = nexttile(L, 7);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Lateral | Posterior", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
ax = nexttile(L, 3);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Anterior | Medial", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
title(L, "J_5 ||Averages|| (N = 29) | 2-mm Cross", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-A | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_J_5_Cross_A");
fig = figure(...
'Name', 'J_5 Cross Sweep (Run24 B)', ...
'Color', 'w',...
'Position',[350 150 875 650]);
L = tiledlayout(fig,3,3);
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 5, ... % This is the center of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 4, ... % This is the lateral part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_x-2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 6, ... % This is the medial part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_x2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 2, ... % This is the anterior part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_y-2mm_-13EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 8, ... % This is the posterior part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Tag', "Run24_J_5_y2mm_-13EMU_Biphasic-Anodal");
ax = nexttile(L, 7);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Lateral | Posterior", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
ax = nexttile(L, 3);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Anterior | Medial", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
title(L, "J_5 ||Averages|| (N = 29) | 2-mm Cross", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-B | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_J_5_Cross_B");
%% J_10
fig = figure(...
'Name', 'J_10 Cross Sweep (Run24 A)', ...
'Color', 'w',...
'Position',[350 150 875 650]);
L = tiledlayout(fig,3,3);
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 5, ... % This is the center of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 4, ... % This is the lateral part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_x-2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 6, ... % This is the medial part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_x2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 2, ... % This is the anterior part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_y-2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 8, ... % This is the posterior part of the cross
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_y2mm_-26EMU_Biphasic-Anodal");
ax = nexttile(L, 7);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Lateral | Posterior", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
ax = nexttile(L, 3);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Anterior | Medial", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
title(L, "J_{10} ||Averages|| (N = 29) | 2-mm Cross", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-A | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_J_10_Cross_A");
fig = figure(...
'Name', 'J_10 Cross Sweep (Run24 B)', ...
'Color', 'w',...
'Position',[350 150 875 650]);
L = tiledlayout(fig,3,3);
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 5, ... % This is the center of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 4, ... % This is the lateral part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_x-2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 6, ... % This is the medial part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_x2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 2, ... % This is the anterior part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_y-2mm_-26EMU_Biphasic-Anodal");
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', 8, ... % This is the posterior part of the cross
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', "Run24_J_10_y2mm_-26EMU_Biphasic-Anodal");
ax = nexttile(L, 7);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Lateral | Posterior", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
ax = nexttile(L, 3);
set(ax, 'NextPlot', 'add', 'XColor', 'none', 'YColor', 'none');
text(ax, 0.5, 0.5, "Anterior | Medial", 'HorizontalAlignment', 'center', 'FontWeight', 'bold', 'FontSize', 16);
title(L, "J_{10} ||Averages|| (N = 29) | 2-mm Cross", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-B | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_J_10_Cross_B");
%% Jsafety sweeps
sweep_data = readtable('+charts/Jsafety_Sweeps.xlsx');
sweep_data.Tag = string(sweep_data.Tag);
T = sweep_data(strcmpi(sweep_data.Sweep, 'Jsafety_10'), :);
fig = figure(...
'Name', 'Jsafety_10 Strip Sweep (Run40 A)', ...
'Color', 'w',...
'Position',[92 545 1563 312]);
L = tiledlayout(fig,max(T.row),max(T.col), 'Padding', 'tight', 'TileSpacing', 'tight');
for iT = 1:size(T,1)
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', {T.index(iT)-(rem(T.index(iT)+1,2)), [1, 2]}, ... % First one is "where does it go"; second is [rows, cols] for size of panel.
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', T.Tag(iT));
end
for ii = 1:numel(L.Children)
xlabel(L.Children(ii), '', 'Color', 'none');
ylabel(L.Children(ii), '', 'Color', 'none');
setRMS_Range(L.Children(ii), [0 3.5]);
end
title(L, "Jsafety_{10} ||Averages|| (N = 24) ", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-A | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_Jsafety_10_Strip_A");
fig = figure(...
'Name', 'Jsafety_10 Strip Sweep (Run40 B)', ...
'Color', 'w',...
'Position',[92 545 1563 312]);
L = tiledlayout(fig,max(T.row),max(T.col), 'Padding', 'tight', 'TileSpacing', 'tight');
for iT = 1:size(T,1)
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', {T.index(iT)-(rem(T.index(iT)+1,2)), [1, 2]}, ... % First one is "where does it go"; second is [rows, cols] for size of panel.
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', T.Tag(iT));
end
for ii = 1:numel(L.Children)
xlabel(L.Children(ii), '', 'Color', 'none');
ylabel(L.Children(ii), '', 'Color', 'none');
setRMS_Range(L.Children(ii), [0 3.5]);
end
title(L, "Jsafety_{10} ||Averages|| (N = 24) ", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-B | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_Jsafety_10_Strip_B");
T = sweep_data(strcmpi(sweep_data.Sweep, 'Jsafety_20'), :);
fig = figure(...
'Name', 'Jsafety_20 Strip Sweep (Run40 A)', ...
'Color', 'w',...
'Position',[92 545 1563 312]);
L = tiledlayout(fig,max(T.row),max(T.col), 'Padding', 'tight', 'TileSpacing', 'tight');
for iT = 1:size(T,1)
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', {T.index(iT)-(rem(T.index(iT)+1,2)), [1, 2]}, ... % First one is "where does it go"; second is [rows, cols] for size of panel.
'Array', "A", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', T.Tag(iT));
end
for ii = 1:numel(L.Children)
xlabel(L.Children(ii), '', 'Color', 'none');
ylabel(L.Children(ii), '', 'Color', 'none');
setRMS_Range(L.Children(ii), [0 3.5]);
end
title(L, "Jsafety_{20} ||Averages|| (N = 24) ", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-A | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_Jsafety_20_Strip_A");
fig = figure(...
'Name', 'Jsafety_20 Strip Sweep (Run40 B)', ...
'Color', 'w',...
'Position',[92 545 1563 312]);
L = tiledlayout(fig,max(T.row),max(T.col), 'Padding', 'tight', 'TileSpacing', 'tight');
for iT = 1:size(T,1)
charts.tiled_mean_arrays("Forrest", 2022, 11, 8, ...
'Tiled_Layout', L, ...
'Tiled_Location', {T.index(iT)-(rem(T.index(iT)+1,2)), [1, 2]}, ... % First one is "where does it go"; second is [rows, cols] for size of panel.
'Array', "B", ...
'Auto_Keep_Figure', true, ...
'Use_CAR', true, ...
'Tag', T.Tag(iT));
end
for ii = 1:numel(L.Children)
xlabel(L.Children(ii), '', 'Color', 'none');
ylabel(L.Children(ii), '', 'Color', 'none');
setRMS_Range(L.Children(ii), [0 3.5]);
end
title(L, "Jsafety_{20} ||Averages|| (N = 24) ", 'FontName', 'Tahoma', 'Color', 'k');
subtitle(L, "(Array-B | 10.0-ms to 30.0-ms after stim onset)", 'FontName', 'Tahoma', 'Color', [0.65 0.65 0.65]);
default.savefig(fig, "C:\Users\Max\Box\N3_SharpFocus\Phase 3 experiments\generated_data\Forrest\Forrest_2022_11_08\figures\Sweeps\Run24_Jsafety_20_Strip_B");