forked from davidjuliancaldwell/DBSanalysisCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DBS_restingState_analysis.m
84 lines (62 loc) · 1.4 KB
/
DBS_restingState_analysis.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
%% DBS resting state analysis
%
% script to analyze resting state data from DBS patients with combined ECoG
% and DBS electrodes
%
% David.J.Caldwell 8.8.2018
Z_ConstantsDBS_PairedPulse
sid = 'c963f';
savePlot = 0;
sid
matlab_dir = 'MATLAB_Converted';
experiment = 'resting';
block = 1;
% load in tank
switch sid
case 'c963f'
switch block
% pre first time
case 1
load(fullfile(SUB_DIR,sid,matlab_dir,experiment,'restingstate-1.mat'));
end
end
%%
% load in data
ECoG = 4*ECOG.data;
fsECoG = ECOG.info.SamplingRateHz;
DBS = 4*DBSs.data;
fsDBS = DBSs.info.SamplingRateHz;
%%
figure
ax(1) = subplot(2,1,1);
t = 1e3*[0:size(DBS,1)-1]/fsDBS;
plot(t,1e6*highpass(DBS,1,fsDBS))
ylim([-100 100])
ylabel('voltage (\muV)')
xlabel('time (ms)')
title('DBS')
ax(2) = subplot(2,1,2);
plot(t,1e6*highpass(ECoG,1,fsECoG))
ylim([-100 100])
ylabel('voltage (\muV)')
xlabel('time (ms)')
title('ECoG')
linkaxes(ax,'xy')
%%
DBSreref = rereference_CAR_median(DBS,'mean');
ECoGreref = rereference_CAR_median(ECoG,'mean');
figure
ax(1) = subplot(2,1,1);
t = 1e3*[0:size(DBS,1)-1]/fsDBS;
plot(t,1e6*highpass(DBSreref,1,fsDBS))
ylim([-100 100])
ylabel('voltage (\muV)')
xlabel('time (ms)')
title('DBS')
ax(2) = subplot(2,1,2);
plot(t,1e6*highpass(ECoGreref,1,fsECoG))
ylim([-100 100])
ylabel('voltage (\muV)')
xlabel('time (ms)')
title('ECoG')
linkaxes(ax,'xy')