forked from psiwex/altaircode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoarPlotter2.m
166 lines (132 loc) · 3.16 KB
/
soarPlotter2.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
close all;
clear;
clc;
load('ernAccSoar.mat','ernAcc');
load('ernRtCorSoar.mat','ernRtCor');
load('ernRtIncSoar.mat','ernRtInc');
load('meanErnESoar.mat','meanErnE');
load('meanCrnESoar.mat','meanCrnE');
load('meanErnCorSoar.mat','ernCorCells');
load('meanErnIncSoar.mat','ernIncCells');
load('meanLstWinsSoar.mat','meanWins');
load('meanLstLossSoar.mat','meanLoss');
load('meanLstWinCellSoar.mat','listWinCells');
load('meanLstLosCellSoar.mat','listLosCells');
load('OSU-00002-04B-01-ERN.bdf.mat')
%% ern parameters
winLength=.5;
preLength=.5;
totalLength=(EEG.srate*(preLength+winLength))+1;
% accuracy and response time
finalMean=mean(ernAcc);
corRtErn=0;
incRtErn=0;
for ji=1:length(ernRtInc)
nBlock=ernRtCor{ji};
nBlock0=ernRtInc{ji};
if isempty(nBlock)==false
vBlock=mean(nBlock);
corRtErn=mean(corRtErn+vBlock);
end
if isempty(nBlock0)==false
vBlock0=mean(nBlock0);
incRtErn=mean(incRtErn+vBlock0);
end
end
chanLim=39;
conErnEeg=zeros(chanLim,totalLength);
incErnEeg=zeros(chanLim,totalLength);
for ji=1:length(ernCorCells)
ernC=ernCorCells{ji};
if isempty(ernC)==false
ernCrn=ernC;
vBlock1=mean(cell2mat(ernC'),3);
vBlock1=vBlock1(1:chanLim,1:totalLength);
conErnEeg=mean(conErnEeg+vBlock1);
end
ernI=ernIncCells{ji};
if isempty(ernI)==false
ernInc=ernI;
try
vBlock2=mean(cell2mat(ernI'),3);
catch
vBlock2=mean(cell2mat(ernI(1)'),3);
try
vBlock1=mean((ernC'),3);
end
end
vBlock2=vBlock2(1:chanLim,1:totalLength);
incErnEeg=mean(incErnEeg+vBlock2);
end
end
%% lst parameters
winLength=1;
totalLengthLst=(EEG.srate*(winLength))+1;
winLstEeg=zeros(chanLim,totalLength);
losLstEeg=zeros(chanLim,totalLength);
for ji=1:length(listWinCells)
ernC=listWinCells{ji};
if isempty(ernC)==false
lstWin=ernC;
try
vBlock1=mean(cell2mat(ernC'),3);
catch
try
vBlock1=mean((ernC'),3);
vBlock1=vBlock1';
catch
vBlock1=mean(cell2mat(ernC(1))',3);
end
end
vBlock1=vBlock1(1:chanLim,1:totalLength);
winLstEeg=mean(winLstEeg+vBlock1);
end
ernC=listLosCells{ji};
if isempty(ernC)==false
lstLos=ernC;
try
vBlock1=mean(cell2mat(ernC'),3);
catch
try
vBlock1=mean((ernC'),3);
vBlock1=vBlock1';
catch
vBlock1=mean(cell2mat(ernC(1))',3);
end
end
vBlock1=vBlock1(1:chanLim,1:totalLength);
losLstEeg=mean(losLstEeg+vBlock1);
end
end
chanSel=39;
%% figures
% ern
% channel fcz is 38
ernI=ernInc{1};
ernC=ernCrn{1};
figure;
xPnts=linspace(-round(preLength*EEG.srate),round(winLength*EEG.srate),totalLength);
plot(xPnts,ernI(chanSel,:))
ylabel('Voltage (uV)')
xlabel('Time (ms)')
hold on;
plot(xPnts,ernC(chanSel,:))
legend('Error','Correct')
hold off;
xx=EEG.chanlocs;
splName='STUDY_headplot.spl';
xx = readlocs('Standard-10-10-Cap47.ced');
headplot('setup', xx, splName)
figure;
%headplot(EEG.data, splName)
headplot(ernI, splName)
% lst
xPnts=linspace(0,round(winLength*EEG.srate),length(winLstEeg));
figure();
plot(xPnts,winLstEeg)
ylabel('Voltage (uV)')
xlabel('Time (s)')
hold on;
plot(xPnts,losLstEeg)
legend('Win','Loss')
hold off;