-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaltairLoopNpu.asv
121 lines (93 loc) · 3.6 KB
/
altairLoopNpu.asv
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
clear;
clc;
tic;
% good subject: OSU-0001-04B-01-NPU
%Adapting our existing pipeline, the steps I plan to implement for NPU startle are:
%-You average about -50 ms prior to stimulus.
%-You filter between 28 Hz high-pass filer, rectified, and then smoothed using a 40 Hz low-pass filter.
%-You look for peak amplitude 20-150-ms after stimulus.
%I presume plotting this with -50 ms to 200 ms might be suitable.
bnds=[.1,30];
raw_bdf_loadpath = 'C:\Users\John\Documents\MATLAB\soarData\';
raw_dataset_savepath = 'C:\Users\John\Documents\MATLAB\soarData\';
ongoing_dataset_savepath = 'C:\Users\John\Documents\MATLAB\soarData\';
processed_dataset_savepath = 'C:\Users\John\Documents\MATLAB\soarData\Completed\';
%erpset_savepath = 'C:\Users\John\Documents\MATLAB\soarData\';
erpset_savepath = 'C:\Users\John\Documents\MATLAB\soarData\erpLabs\';
raw_eventlist_savepath = 'C:\Users\John\Documents\MATLAB\soarData\';
processed_eventlist_savepath = 'C:\Users\John\Documents\MATLAB\soarData\';
binListerPath = 'C:\Users\John\Documents\MATLAB\soarEtl\currentSoar\NpuBinlister.txt';
% channelLocationFile: this path is found in your eeglab dipfit plugin folder: eeglab\plugins\dipfit\standard_BESA\standard-10-5-cap385.elp
channelLocationFile = 'C:\Users\John\Documents\MATLAB\eeglab2021.1\plugins\dipfit\standard_BESA\standard-10-5-cap385.elp';
%channelLocationFile = 'C:\Users\glaze\Documents\MatLabPrograms\eeglab2020_0\plugins\dipfit\standard_BESA\standard-10-5-cap385.elp';
%fName='OSU-00001-04B-01-LST.bdf';
subst2='npu.bdf';
subst='NPU.bdf';
outEx='_kukri_npu.mat';
outEx2='_kukri_n_erp.mat';
dirName = 'C:\Users\John\Documents\MATLAB\soarData\';
[sub] = subdir(dirName);
erpnpus={};
erpnpuNames={};
erpernNum=1;
erpernFileNum=1;
erplstFiles={};
fNameList={};
metaData=struct2table(sub);
fileList=metaData.name;
% ii=fileList(1);
%load('erpernsFiles.mat','erpernsFiles');
%fileList=erplstFiles;
erpernNames={};
for ij=1:length(fileList)
ij/length(fileList)
ii=fileList(ij);
fName=ii{1};
fNameList{ij}=fName;
tf = endsWith(fName,subst);
tf2 = endsWith(fName,subst2);
if tf ~= (0)
erplstFiles{erpernFileNum}=fName;
erpernFileNum=erpernFileNum+1;
outName=append(fName,outEx);
try
%[EEG,ERP,erns] = altairLstPreproc(fName,binListerPath,channelLocationFile);
[EEG,ERP,erns] = altairNpuPreproc(fName,raw_dataset_savepath,ongoing_dataset_savepath,erpset_savepath,binListerPath,channelLocationFile)
%[EEG,ERP,erns] = altairLstPreproc(fName,raw_dataset_savepath,ongoing_dataset_savepath,erpset_savepath,binListerPath,channelLocationFile)
close all;
erpnpuNames{erpernNum}=fName;
erpernNum=erpernNum+1;
save(outName,'EEG')
outName
catch
end
if tf2 ~= (0)
erplstFiles{erpernFileNum}=fName;
erpernFileNum=erpernFileNum+1;
outName=append(fName,outEx);
try
[EEG,ERP,erns] = altairNpuPreproc(fName,raw_dataset_savepath,ongoing_dataset_savepath,erpset_savepath,binListerPath,channelLocationFile)
%[EEG,ERP,erns] = altairLstPreproc(fName,raw_dataset_savepath,ongoing_dataset_savepath,erpset_savepath,binListerPath,channelLocationFile);
%[EEG,ERP,erns] = altairDoorsPreproc(fName,raw_dataset_savepath,ongoing_dataset_savepath,erpset_savepath,binlister_loadpath,channelLocationFile);
close all;
erpnpuNames{erpernNum}=fName;
erpernNum=erpernNum+1;
save(outName,'EEG')
outName
catch
end
end
end
%load(outName,'EEG')
%EEG = eeg_checkset(EEG); clc;
%save(outName,'EEG')
%snr1 = snrCompare(EEG.data,bnds,EEG.srate);
%end
%chanPercent=[chanPercent; chanPer];
%save('soarSnrResample5.mat','chanPercent');
end
%finalMean=mean(chanPercent);
%truPer=chanPercent(find(chanPercent~=1));
%trueMean=mean(truPer);
save('erpnpuNames.mat','erpnpuNames');
toc;