-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwmChoose_runPreProc.m
More file actions
78 lines (53 loc) · 2.28 KB
/
wmChoose_runPreProc.m
File metadata and controls
78 lines (53 loc) · 2.28 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
close all;
%root = 'Z:/projects/wmChoose';
root = 'Z:/projects/wmChooseSD1';
ifg_fn = 'C:/Users/li/Documents/MATLAB/iEye_ts/examples/p_1000hz.ifg';
subj = {'sub001','sub002','sub003'};
runs_with_err = {};
errs = {};
%fn_prefix = 'wmChoose_behavSD1'; % OR _ds_preCue
fn_prefix = 'wmChoose_behav1'; % OR _ds_preCue
% set up iEye params
ii_params = ii_loadparams;
ii_params.trial_end_value = 5;
ii_params.drift_epoch = [1 2];
ii_params.calibrate_epoch = 4;
ii_params.calibrate_select_mode = 'last';
ii_params.calibrate_window = 300;
ii_params.blink_window = [200 200];
ii_params.plot_epoch = [3 4];
ii_params.calibrate_limits = [1.5]; % original ecc b/w 9 and 16...
%ii_params.ppd = 34.1445; % behavioral room screen
for ss = 1:length(subj)
fns = sprintf('%s/data/%s_r*_%s_*.edf',root,subj{ss},fn_prefix);
thisf = dir(fns);
clear fns;
% remove files that are "r00"
for ff = 1:length(thisf)
fprintf('Preprocessing %s\n',thisf(ff).name);
this_edf = sprintf('%s/data/%s',root,thisf(ff).name);
% look for matching mat file
%fns = sprintf('%s/data/%s_%s*block%02.f_*.mat',root,subj{ss},fn_prefix,block_num);
%matf = dir(fns);
matf = sprintf('%smat',this_edf(1:end-3));
thisbehav = load(matf);
% for convenience...
thisbehav = thisbehav.p;
ii_params.ppd = thisbehav.ppd;
% custom for each expt
block_num = str2double(matf(strfind(matf,'_r')+[2 3]));
% turn targ_coords variable into cell of cells
% TODO: allow each cell to have numel==n_selections * 2
coords = cell(thisbehav.ntrials,1);
for tt = 1:thisbehav.ntrials
coords{tt} = {thisbehav.targ_coords{1}(tt,:), thisbehav.targ_coords{2}(tt,:)};
end
% set up trialinfo
trial_info = horzcat(thisbehav.conditions,thisbehav.targ_coords{:});
preproc_fn = sprintf('%s/preproc_iEye/%s_%s_r%02.f_preproc.mat',root,subj{ss},fn_prefix,block_num);
wmChoose_preproc1(this_edf,ifg_fn,preproc_fn,coords,trial_info,ii_params);
close all;
close all hidden;
clear preproc_fn trial_info cond thisbehav matf fns block_num this_edf thisbehav;
end
end