Newer
Older
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
120
121
122
123
124
125
126
127
%_______________________________________________________________________
%
% Development wrapper for presentation
%_______________________________________________________________________
%
% Input
%
% runMode | deployed - full length experiment
% test_design - 60 seconds test with design file
% test_medium - 120 seconds test (2 conditions, intro)
% test_short - 10 seconds test (1 conditions, no intro)
%
% dataDir | path for design and behavioural data (string)
% subCode | subject identifier (string)
%_______________________________________________________________________
%
function dotsWrapper(runMode, dataReadDir, dataWriteDir, subCode)
if nargin == 0
eval('help dotsWrapper')
return
end
dotInfo = createDotInfo; % fetch current configuration
if not(exist('runMode','var'))
runMode = 'deployed';
elseif isempty(runMode) || not(ischar(runMode))
error('Invalid run mode (development, testing or deployed)')
end
if exist('dataWriteDir','var')
if not(exist(dataWriteDir,'dir'))
mkdir(dataWriteDir)
end
dotInfo.dataDir = dataWriteDir;
else
%%
%% TODO: this should probably not happen when running test modes on
%% the client computers at the SNS lab so maybe only define
%% dataDir in dotsX_ClientWrapper!
%%
dataWriteDir = fullfile(getenv('HOME'), 'Desktop', 'DotsX', 'datasns');
dotInfo.dataDir = dataWriteDir;
end
if not(strcmp(runMode,'deployed')) && not(exist('subCode','var'))
subCode = 'computer1';
end
[~, sysName] = system('hostname');
sysName = deblank(sysName);
switch runMode
%% actual design without limitations
case 'deployed'
useDesignFile = true;
%% short duration but use design file
case 'test_design'
useDesignFile = true;
dotInfo.introNumTrial = 5; % number of introduction trials
dotInfo.numBlock = 2; % number of blocks per condition
dotInfo.condTime = 20; % condition duration in seconds
dotInfo.blockTime = dotInfo.condTime / dotInfo.numBlock; % block duration in seconds
dotInfo.breakTime = 3; % break between blocks in seconds
dotInfo.deployed = false; % keeps mouse cursor visible during presentation
%% medium duration to test overall user experience
case 'test_medium'
useDesignFile = false;
condSet = {'white','blue'};
dotInfo.introNumTrial = 20; % number of introduction trials
dotInfo.numBlock = 2; % number of blocks per condition
dotInfo.condTime = 60; % condition duration in seconds
dotInfo.blockTime = dotInfo.condTime / dotInfo.numBlock; % block duration in seconds
dotInfo.breakTime = 10; % break between blocks in seconds
dotInfo.deployed = false; % keeps mouse cursor visible during presentation
%% short duration to test presentation and keyboard interaction
case 'test_short'
useDesignFile = false;
condSet = {'white'};
dotInfo.introNumTrial = 0; % number of introduction trials
dotInfo.numBlock = 1; % number of blocks per condition
dotInfo.condTime = 10; % condition duration in seconds
dotInfo.blockTime = dotInfo.condTime / dotInfo.numBlock; % block duration in seconds
dotInfo.breakTime = 3; % break between blocks in seconds
dotInfo.deployed = false; % keeps mouse cursor visible during presentation
otherwise
error('invalid run mode (development, testing, deployed)')
end
if useDesignFile
% designFile = ['dotsX_design_' datestr(now,'yyyy-mm-dd')];
designFile = 'dotsX_design_2016-10-03';
designFile = fullfile(dataReadDir, designFile);
load(designFile, 'condMat', 'subjMat');
subCode = upper(subCode);
subjIndex = find(ismember(subjMat,subCode));
if numel(subjIndex) == 0
msg = sprintf('subject %s not found in subject index', subCode);
error(msg)
elseif numel(subjIndex) > 1
msg = sprintf('subject %s found multiple times in subject index', subCode);
error(msg)
else
condSet = condMat{subjIndex};
end
end
if ismac || strcmp(sysName,'LIP-WIN-000413')
Screen('Preference', 'SkipSyncTests', 1); % for testing on Macs/older Windows PCs
else
Screen('Preference', 'SkipSyncTests', 0); % to assure proper timing of experiment
end
if strcmp(sysName,'LIP-WIN-000413')
Screen('Preference', 'ConserveVRAM', 64); % to avoid graphics error on Windows PC
end
dotsExperiment(dotInfo, subCode, condSet);
end