forked from hharveygit/SPES_reference_contam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.m
More file actions
59 lines (51 loc) · 2.33 KB
/
main.m
File metadata and controls
59 lines (51 loc) · 2.33 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
%% Code walkthrough to generate all results and figures
%
% If this code is used in a publication, please cite the manuscript:
% "Proper reference selection and re-referencing to mitigate bias in single pulse electrical stimulation data"
% by H. Huang, J.A. Adkinson, M.A. Jensen, M. Hasen, I.A. Danstrom, K.R. Bijanki, N.M. Gregg, K.J. Miller,
% S.A. Sheth, D. Hermes, E. Bartoli.
%
% Main script
% Copyright (C) 2025 Harvey Huang
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Required packages:
% - mnl_ieegBasics: https://github.com/MultimodalNeuroimagingLab/mnl_ieegBasics
% - CRP_method is already included in ./functions to avoid separate installation. See file for original reference.
%
% Download the data files from OSF (https://osf.io/ryfqt/) and copy them to a "data" folder in the working directory (./data)
% set paths, make output directory
addpath('functions');
addpath('data');
mkdir('output');
addpath('output');
%% Run modified CARLA on Baylor and Mayo datasets
% Saves all figure 1 panels/results,
% as well as intermediates, CAR waveforms, and response duration histogram (sub 2) for figure 2
% Note that CARLA is not deterministic and outputs will vary slightly on repeat iteration
dataStr = 'baylor'; % to configure which subject is asved
comparePEP_SFN2024
dataStr = 'mayo_LK1-LK2';
comparePEP_SFN2024
%% Rest of results for figure 2
% This saves correlation heatmaps, positive/negative peak latency histograms, values in Table S1
dataStr = 'baylor';
Latency_FindPeaks_EB
dataStr = 'mayo_LK1-LK2';
Latency_FindPeaks_EB
% This saves the model PEP with response duration marked in Figure 2, bottom left
simCCEP_CRP