-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathperiodogram_allconditions_noripples.m
315 lines (239 loc) · 6.88 KB
/
periodogram_allconditions_noripples.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
309
310
311
312
313
314
315
acer=0;
%
if acer==0
addpath('/home/raleman/Documents/MATLAB/analysis-tools-master'); %Open Ephys data loader.
addpath('/home/raleman/Documents/GitHub/CorticoHippocampal')
addpath('/home/raleman/Documents/internship')
else
addpath('D:\internship\analysis-tools-master'); %Open Ephys data loader.
addpath('C:\Users\Welt Meister\Documents\Donders\CorticoHippocampal\CorticoHippocampal')
end
%%
%Rat=26;
for Rat=1:1
rats=[26 27 21];
Rat=rats(Rat);
if Rat==26
nFF=[
% {'rat26_Base_II_2016-03-24' }
% {'rat26_Base_II_2016-03-24_09-47-13' }
% {'rat26_Base_II_2016-03-24_12-55-58' }
% {'rat26_Base_II_2016-03-24_12-57-57' }
{'rat26_nl_base_III_2016-03-30_10-32-57' }
{'rat26_nl_base_II_2016-03-28_10-40-19' }
{'rat26_nl_baseline2016-03-01_11-01-55' }
{'rat26_plusmaze_base_2016-03-08_10-24-41'}
{'rat26_novelty_I_2016-04-12_10-05-55' }
{'rat26_novelty_II_2016-04-13_10-23-29' }
{'rat26_for_2016-03-21_10-38-54' }
{'rat26_for_II_2016-03-23_10-49-50' }
];
% labelconditions=[
% {'Baseline_1'
% 'Baseline_2'}
% 'Baseline_3'
% 'PlusMaze'
% 'Novelty_1'
% 'Novelty_2'
% 'Foraging_1'
% 'Foraging_2'
% ];
labelconditions=[
{
'Baseline_1'}
'Baseline_2'
'Baseline_3'
'PlusMaze'
'Novelty_1'
'Novelty_2'
'Foraging_1'
'Foraging_2'
];
end
if Rat==27
nFF=[
{'rat27_nl_base_2016-03-28_15-01-17' }
{'rat27_NL_baseline_2016-02-26_12-50-26' }
{'rat27_nl_base_III_2016-03-30_14-36-57' }
{'rat27_plusmaze_base_2016-03-14_14-52-48' }
{'rat27_plusmaze_base_II_2016-03-24_14-10-08' }
{'rat27_for_2016-03-21_15-03-05' }
{'Rat27_for_II_2016-03-23_15-06-59' }
%{'rat27_novelty_II_2016-04-13_14-37-58' } %NO .MAT files found.
%{'rat27_novelty_II_2016-04-13_16-29-42' } %No (complete).MAT files found.
{'rat27_novelty_I_2016-04-11_14-34-55' }
% {'rat27_plusmaze_dis_2016-03-10_14-35-18' }
% {'rat27_plusmaze_dis_II_2016-03-16_14-36-07' }
% {'rat27_plusmaze_dis_II_2016-03-18_14-46-24' }
% {'rat27_plusmaze_jit_2016-03-08_14-46-31' }
% {'rat27_plusmaze_jit_II_2016-03-16_15-02-27' }
% {'rat27_plusmaze_swrd_qPCR_2016-04-15_14-28-41' }
% {'rat27_watermaze_dis_morning_2016-04-06_10-18-36' }
% {'rat27_watermaze_jitter_afternoon_2016-04-06_15-41-51'}
]
labelconditions=[
{
'Baseline_1'}
'Baseline_2'
'Baseline_3'
'PlusMaze_1'
'PlusMaze_2'
'Foraging_1'
'Foraging_2'
'Novelty_1'
];
end
if Rat==21
nFF=[
{'2015-11-27_13-50-07 5h baseline' }
{'rat21 baselin2015-12-11_12-52-58' }
{'rat21_learningbaseline2_2015-12-10_15-24-17' }
{'rat21with45minlearning_2015-12-02_14-25-12' }
%{'rat21t_maze_2015-12-14_13-29-07' }
{'rat21 post t-maze 2015-12-14_13-30-52' }
];
%%
labelconditions=[
{
'Learning Baseline'
}
'45minLearning'
'Novelty_2'
't-maze'
'Post t-maze'
];
end
%% Go to main directory
if acer==0
cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
addpath /home/raleman/Documents/internship/fieldtrip-master/
cd /home/raleman/Documents/internship/fieldtrip-master
InitFieldtrip()
cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
clc
else
cd(strcat('D:\internship\',num2str(Rat)))
addpath D:\internship\fieldtrip-master
cd D:\internship\fieldtrip-master
InitFieldtrip()
% cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
cd(strcat('D:\internship\',num2str(Rat)))
clc
end
%% Select experiment to perform.
inter=1;
granger=0;
%Select length of window in seconds:
ro=[1200];
coher=0;
selectripples=1;
mergebaseline=1;
nrem=3;
notch=0;
%%
%Make labels
label1=cell(7,1);
label1{1}='Hippocampus';
label1{2}='Hippocampus';
label1{3}='Parietal';
label1{4}='Parietal';
label1{5}='PFC';
label1{6}='PFC';
label1{7}='Reference';
label2=cell(7,1);
label2{1}='Monopolar';
label2{2}='Bipolar';
label2{3}='Monopolar';
label2{4}='Bipolar';
label2{5}='Monopolar';
label2{6}='Bipolar';
label2{7}='Monopolar';
%%
%clearvars -except nFF iii labelconditions inter granger Rat ro label1 label2 coher selectripples acer mergebaseline nr_27 nr_26 co_26 co_27 nrem notch
% for level=1:1
for w=1:1
if Rat==21
myColorMap = jet(5);
else
myColorMap = jet(8);
end
% colormap(myColorMap);
NCount=nan(length(nFF),1);
for iii=1:length(nFF)
%for level=2:2
myColorMap = jet(24);
if acer==0
cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
else
cd(strcat('D:\internship\',num2str(Rat)))
end
cd(nFF{iii})
%Get averaged time signal.
%error('stop')
S=load('powercoh.mat');
semilogy(S.F,(S.px/sum(S.px)),'Color',myColorMap(iii*3,:),'LineWidth',2)
hold on
%plot(f,(px)/sum(px),'Color',myColorMap(level*3,:),'LineWidth',1.5)
% semilogy(f,(px/sum(px)),'Color',[1 0 0],'LineWidth',2)
grid on
ax=gca;
ax.GridColor=[ 1,1,1];
% AX=legend('With Ripples','No Ripples (THR 2)');
% AX.Location= 'southwest';
xlim([0 250])
grid minor
xlabel('Frequency (Hz)')
%ylabel('10 Log(x)')
%ylabel('Normalized Power')
ylabel('Normalized Power')
%end
%legend('HPC','PAR','PFC')
title(strcat('Power after Ripple removal in NREM',{' '} ,label1{2*w-1} ,{' '},'signals'))
% handxlabel1 = get(gca, 'XLabel');
% set(handxlabel1, 'FontSize', 12, 'FontWeight', 'bold')
% handylabel1 = get(gca, 'ylabel');
% set(handylabel1, 'FontSize', 12, 'FontWeight', 'bold')
% handaxes2 = axes('Position', [0.6 0.6 0.3 0.3]);
%
%
% G=area(fa,mean(va,2));
% G.FaceColor=[1 1 0];
% grid minor
%
% %ylim([min(mean(va,2)) 1])
% ylim([0.5 1])
% xlim([0 250])
% % xlabel('Frequency (Hz)')
% % ylabel('Coherence')
% xlabel('Frequency (Hz)','Color','w')
% ylabel('Coherence','Color','w')
% % title('With Ripples vs No Ripples (THR 2)')
% set(gca,'xcolor','w')
% set(gca,'ycolor','w')
% xticks([0 50 100 150 200])
%
end
legend(labelconditions)
set(gca,'Color','k')
error('stop')
if acer==0
cd(strcat('/home/raleman/Dropbox/Power_Coh/',num2str(Rat)))
else
cd(strcat('C:\Users\Welt Meister\Dropbox\Power_Coh\',num2str(Rat)))
end
fig=gcf;
fig.InvertHardcopy='off';
% string=strcat('300hz_intra_',label1{2*w-1},'.png');
string=strcat('NoRipples_',labelconditions{iii},'.png');
saveas(gcf,string)
string=strcat('NoRipples_',labelconditions{iii},'.fig');
saveas(gcf,string)
close all
%end
% error('stop')
%string=strcat('Power_50B_1850_NOTCH_NREM_',label1{2*w-1},'.png');
% end
end
%%
end
%end