-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper.m
More file actions
63 lines (51 loc) · 2.6 KB
/
wrapper.m
File metadata and controls
63 lines (51 loc) · 2.6 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
% executes all sub-scripts in the correct order and collects intermediate
% results
clear; plotting = false;
addpath('Utilities');
% settings
orientations = [0 90]; % rotAngles of gratings to use
subID = input('Please enter participant name: ','s'); % get the subject ID
outDir = fullfile('Results',subID);
if ~exist(outDir,'dir'); mkdir(outDir); else; warning('Directory already exists!'); end
% =========================================================================
% Practice detection - outside scanner
% =========================================================================
% just a few trials per orientation to get an idea of what gratings in
% noise look like
[PD,PA,V] = practiceDetection(subID,orientations); % also gives a rough
% initial estimate of V (visibility)
% =========================================================================
% Initial staircase - outside scanner
% =========================================================================
% Provide an initial estimate of the contrast, to be fine tuned in the
% scanner later
[SC_V1,SC_acc1] = outsideStaircase(subID,orientations(1),'A',V,'test'); % grating 1
save(fullfile(outDir,sprintf('%s_settings',subID)),'SC_V1','-append')
[SC_V2,SC_acc2] = outsideStaircase(subID,orientations(2),'B',V,'test'); % grating 2
save(fullfile(outDir,sprintf('%s_settings',subID)),'SC_V2','-append')
% plot
subplot(2,1,1);
plot(SC_V1,'-o'); hold on; plot(SC_V2,'-o');
legend('Orientation 1','Orientation 2');
ylabel('Visibility')
subplot(2,1,2);
plot(SC_acc1,'-o'); hold on; plot(SC_acc2,'-o');
hold on; plot(xlim,[0.7 0.7],'k--')
legend('Orientation 1','Orientation 2');
ylabel('Accuracy');
[~,b1] = min(abs(SC_acc1-0.7));
[~,b2] = min(abs(SC_acc2-0.7));
V = mean([SC_V1(b1) SC_V2(b2)]); % take mean staircased SAME FOR BOTH STIMULI!?
% =========================================================================
% Practice imagery - outside scanner
% =========================================================================
% includes a pretty difficult discimrination task, practice is done once
% participant has 10 correct trials ina row
[PI_V,PI_P] = practiceImagery(subID,orientations);
% =========================================================================
% Practice main task - outside scanner
% =========================================================================
% includes all elements of the main task, working at a rough estimate of
% the visibility % visibility to practice task
PMT = practiceMainTask(subID,orientations,V);
sca