-
Notifications
You must be signed in to change notification settings - Fork 2
/
count_ripples.m
199 lines (152 loc) · 4.68 KB
/
count_ripples.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
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=26:27
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=[
{
'PlusMaze'
}
'Novelty_1'
'Novelty_2'
'Foraging_1'
'Foraging_2'
];
else
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
%% Go to main directory
if acer==0
cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
addpath /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
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=0;
mergebaseline=0;
%%
%Make labels
label1=cell(7,1);
label1{1}='Hippo';
label1{2}='Hippo';
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';
%%
for iii=1:length(nFF)
clearvars -except nFF iii labelconditions inter granger Rat ro label1 label2 coher selectripples acer mergebaseline nr_27 nr_26 co_26 co_27
if acer==0
cd(strcat('/home/raleman/Documents/internship/',num2str(Rat)))
else
cd(strcat('D:\internship\',num2str(Rat)))
end
cd(nFF{iii})
%for level=1:length(ripple)-1;
for level=1:3
if ro==1200 && inter==0 && granger==0
run('newest_load_data.m')
else
[sig1,sig2,ripple,carajo,veamos,CHTM,RipFreq2,timeasleep]=newest_only_ripple_level(level);
end
% ripple=ripple2;
%Get p and q.
%Get averaged time signal.
% % % % % % % [p,q,timecell,Q,~,~]=getwin2(carajo{:,:,1},veamos{1},sig1,sig2,label1,label2,ro,ripple(1),CHTM(level+1));
if Rat==26
nr_26(iii,level)=ripple;
co_26(iii,level)=RipFreq2;
else
nr_27(iii,level)=ripple;
co_27(iii,level)=RipFreq2;
end
end
%%
end
end