-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompute_tfgroup.m
More file actions
executable file
·76 lines (59 loc) · 2.38 KB
/
compute_tfgroup.m
File metadata and controls
executable file
·76 lines (59 loc) · 2.38 KB
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
clear, close all
restoredefaultpath
addpath(genpath('Z:\Toolboxes\eeglab12_0_2_3b'));
addpath(genpath('Z:\Toolboxes\colormaps'));
addpath('Z:\Toolboxes\Statstuff\')
% IO definitions
readdir = 'Z:\TemplateSwitch\EEG\results\prestim_baseline\';
cd(readdir)
filz = dir('*eegeye_tfdecomp.mat');
%% load data
load(filz(1).name)
tf_all_pow = zeros([length(filz) size(tf_pow)]);
tf_all_pow(1,:,:,:,:) = tf_pow;
tf_all_sync = zeros([length(filz) size(tf_sync)]);
tf_all_sync(1,:,:,:,:,:) = tf_sync;
nsubjects = length(filz);
for subno=2:nsubjects
load(filz(subno).name,'tf_pow','tf_sync','dim')
tf_all_pow(subno,:,:,:,:) = tf_pow;
tf_all_sync(subno,:,:,:,:,:) = tf_sync;
end
%%
elecs2plot_lab = {'o1','oz','o2'};
elecs2plot_idx = zeros(1,length(elecs2plot_lab));
for chani=1:length(elecs2plot_lab)
elecs2plot_idx(chani) = find(strcmpi({dim.chans.labels}, elecs2plot_lab{chani}));
end
figure
for sp=1:4
subplot(4,2,sp)
contourf(dim.times,dim.freqs,squeeze(mean(mean(tf_all_pow(:,sp,elecs2plot_idx,:,:),1),3)),50,'linecolor','none')
set(gca,'yscale','log','ytick',[2 4 8 16 32],'clim',[-3 3])
end
elecs2plot_lab = {'fcz'};
elecs2plot_idx = zeros(1,length(elecs2plot_lab));
for chani=1:length(elecs2plot_lab)
elecs2plot_idx(chani) = find(strcmpi({dim.chans.labels}, elecs2plot_lab{chani}));
end
for sp=1:4
subplot(4,2,sp+4)
contourf(dim.times,dim.freqs,squeeze(mean(mean(tf_all_pow(:,sp,elecs2plot_idx,:,:),1),3)),50,'linecolor','none')
set(gca,'yscale','log','ytick',[2 4 8 16 32],'clim',[-1 1])
end
%%
elecs2plot_lab = {'po3','po4'};
elecs2plot_idx = zeros(1,length(elecs2plot_lab));
for chani=1:length(elecs2plot_lab)
elecs2plot_idx(chani) = find(strcmpi({dim.chans.labels}, elecs2plot_lab{chani}));
end
tfwin = [-500 -250; 14 20];
time=dsearchn(dim.times',tfwin(1,:)')'; time=time(1):time(2);
freq=dsearchn(dim.freqs',tfwin(2,:)')'; freq=freq(1):freq(2);
figure
subplot(211)
contourf(dim.times,dim.freqs,squeeze(mean(mean(mean(tf_all_pow(:,:,elecs2plot_idx,:,:),1),2),3)),50,'linecolor','none')
set(gca,'yscale','log','ytick',[2 4 8 16 32],'clim',[-1 1],'xlim',[-500 500])
rectangle('position',[tfwin(1,1) tfwin(2,1) tfwin(1,2)-tfwin(1,1) tfwin(2,2)-tfwin(2,1)])
subplot(212)
topoplot(squeeze(mean(mean(mean(mean( tf_all_pow(:,:,:,freq,time), 1),2),4),5)),dim.chans,'electrodes','off');