|
4 | 4 | %> Objects provide many methods you can run, like sending triggers, showing |
5 | 5 | %> stimuli, controlling the eyetracker etc. |
6 | 6 | % |
7 | | -%> The following class objects are already loaded and available to use: |
| 7 | +%> This state file is loaded by the runExperiment class. runExperiment |
| 8 | +%> initialises other classes that are used to control the experiment. The |
| 9 | +%> following class objects are already loaded and available to use: |
8 | 10 | % |
9 | | -%> me = runExperiment object |
10 | | -%> io = digital I/O to recording system |
11 | | -%> s = screenManager |
12 | | -%> aM = audioManager |
13 | | -%> sM = State Machine |
14 | | -%> eT = eyetracker manager |
15 | | -%> task = task sequence (taskSequence class) |
16 | | -%> rM = Reward Manager (LabJack or Arduino TTL trigger to reward system/Magstim) |
17 | | -%> bR = behavioural record plot (on screen GUI during task run) |
18 | | -%> stims = our list of stimuli |
19 | | -%> tS = general struct to hold variables for this run, will be saved as part of the data |
| 11 | +%> me = runExperiment object |
| 12 | +%> s = screenManager |
| 13 | +%> sM = State Machine |
| 14 | +%> eT = eyetracker manager |
| 15 | +%> task = task sequence (taskSequence class) |
| 16 | +%> stims = our list of stimuli |
| 17 | +%> io = digital I/O to recording system |
| 18 | +%> aM = audioManager |
| 19 | +%> rM = Reward Manager (LabJack or Arduino TTL trigger to reward system/Magstim) |
| 20 | +%> bR = behavioural record plot (on screen GUI of trial performance during task run) |
| 21 | +%> tL = timeLog that records the timing of experiment |
| 22 | +%> tS = general struct to hold variables for this run, will be saved as part of the data |
20 | 23 |
|
21 | 24 | %================================================================== |
22 | | -%---------------------------TASK SWITCH---------------------------- |
| 25 | +%---------------------------TASK CONFIG---------------------------- |
| 26 | +%do we update the trial number even for incorrect saccades, if true then we |
| 27 | +%call updateTask for both correct and incorrect, otherwise we only call |
| 28 | +%updateTask() for correct responses |
| 29 | +tS.includeErrors = false; |
23 | 30 | tS.type = 'saccade'; %will be be saccade or antisaccade task run? |
24 | | -tS.includeErrors = true; %do we update the trial number even for incorrect saccades, if true then we call updateTask for both correct and incorrect, otherwise we only call updateTask() for correct responses |
25 | 31 | if strcmp(tS.type,'saccade') |
26 | 32 | stims{1}.showOnTracker = true; |
27 | 33 | stims{2}.showOnTracker = false; |
|
49 | 55 | %================================================================== |
50 | 56 | %------------Debug logging to command window----------------- |
51 | 57 | %io.verbose = true; %==print out io commands for debugging |
52 | | -%eT.verbose = true; %==print out eyelink commands for debugging |
| 58 | +%eT.verbose = true; %==print out eyetracker commands for debugging |
53 | 59 | %rM.verbose = true; %==print out reward commands for debugging |
54 | 60 |
|
55 | 61 | %================================================================== |
|
71 | 77 |
|
72 | 78 | %================================================================== |
73 | 79 | %---------------------------Eyetracker setup----------------------- |
| 80 | +% note: opticka UI sets some defaults, but these will override the UI |
74 | 81 | if me.useEyeLink |
75 | 82 | warning('Note this protocol is optimised for the Tobii eyetracker, beware...') |
76 | 83 | eT.name = tS.name; |
77 | 84 | eT.sampleRate = 250; % sampling rate |
78 | 85 | eT.calibrationStyle = 'HV5'; % calibration style |
79 | 86 | eT.calibrationProportion = [0.4 0.4]; %the proportion of the screen occupied by the calibration stimuli |
80 | 87 | if tS.saveData == true; eT.recordData = true; end %===save EDF file? |
81 | | - if me.dummyMode; eT.isDummy = true; end %===use dummy or real eyetracker? |
82 | 88 | %----------------------- |
83 | 89 | % remote calibration enables manual control and selection of each fixation |
84 | 90 | % this is useful for a baby or monkey who has not been trained for fixation |
|
94 | 100 | eT.modify.targetbeep = 1; % beep during calibration |
95 | 101 | elseif me.useTobii |
96 | 102 | eT.name = tS.name; |
97 | | - eT.model = 'Tobii Pro Spectrum'; |
98 | | - eT.sampleRate = 300; |
99 | | - eT.trackingMode = 'human'; |
100 | | - eT.calibrationStimulus = 'animated'; |
101 | | - eT.autoPace = true; |
| 103 | + %eT.model = 'Tobii Pro Spectrum'; |
| 104 | + %eT.sampleRate = 300; |
| 105 | + %eT.trackingMode = 'human'; |
| 106 | + %eT.calibrationStimulus = 'animated'; |
| 107 | + %eT.autoPace = true; |
102 | 108 | %----------------------- |
103 | 109 | % remote calibration enables manual control and selection of each fixation |
104 | 110 | % this is useful for a baby or monkey who has not been trained for fixation |
105 | | - eT.manualCalibration = false; |
| 111 | + %eT.manualCalibration = false; |
106 | 112 | %----------------------- |
107 | | - eT.calPositions = [ .2 .5; .5 .5; .8 .5]; |
108 | | - eT.valPositions = [ .5 .5 ]; |
109 | | - if me.dummyMode; eT.isDummy = true; end %===use dummy or real eyetracker? |
| 113 | + %eT.calPositions = [ .2 .5; .5 .5; .8 .5]; |
| 114 | + %eT.valPositions = [ .5 .5 ]; |
110 | 115 | end |
111 | 116 | %Initialise the eyeTracker object with X, Y, FixInitTime, FixTime, Radius, StrictFix |
112 | 117 | eT.updateFixationValues(tS.fixX, tS.fixY, tS.firstFixInit, tS.firstFixTime, tS.firstFixRadius, tS.strict); |
113 | | -%make sure we don't start with any exclusion zones set up |
| 118 | +%Ensure we don't start with any exclusion zones set up |
114 | 119 | eT.resetExclusionZones(); |
115 | 120 |
|
116 | 121 | %================================================================== |
|
171 | 176 | sM.skipExitStates = {'fixate','incorrect|breakfix'}; |
172 | 177 |
|
173 | 178 | %=================================================================== |
174 | | -%-----------------State Machine State Functions--------------------- |
175 | | -% each cell {array} holds a set of anonymous function handles which are executed by the |
176 | | -% state machine to control the experiment. The state machine can run sets |
177 | | -% at entry, during, to trigger a transition, and at exit. Remember these |
178 | | -% {sets} need to access the objects that are available within the |
179 | | -% runExperiment context (see top of file). You can also add global |
180 | | -% variables/objects then use these. The values entered here are set on |
181 | | -% load, if you want up-to-date values then you need to use methods/function |
182 | | -% wrappers to retrieve/set them. |
183 | | - |
| 179 | +%=================================================================== |
| 180 | +%=================================================================== |
| 181 | +%-----------------State Machine Task Functions--------------------- |
| 182 | +% Each cell {array} holds a set of anonymous function handles which are |
| 183 | +% executed by the state machine to control the experiment. The state |
| 184 | +% machine can run sets at entry ['entryFcn'], during ['withinFcn'], to |
| 185 | +% trigger a transition jump to another state ['transitionFcn'], and at exit |
| 186 | +% ['exitFcn'. Remember these {sets} need to access the objects that are |
| 187 | +% available within the runExperiment context (see top of file). You can |
| 188 | +% also add global variables/objects then use these. The values entered here |
| 189 | +% are set on load, if you want up-to-date values then you need to use |
| 190 | +% methods/function wrappers to retrieve/set them. |
| 191 | + |
| 192 | +%====================================================PAUSE |
184 | 193 | %pause entry |
185 | 194 | pauseEntryFcn = { |
186 | 195 | @()hide(stims); |
|
201 | 210 | @()startRecording(eT, true); %start recording eye position data again |
202 | 211 | }; |
203 | 212 |
|
| 213 | +%====================================================PREFIXATION |
204 | 214 | prefixEntryFcn = { |
205 | 215 | @()enableFlip(me); |
206 | 216 | }; |
|
214 | 224 | @()edit(stims,3,'alpha2Out',1); |
215 | 225 | }; |
216 | 226 |
|
| 227 | +%====================================================FIXATION |
217 | 228 | %fixate entry |
218 | 229 | fixEntryFcn = { |
219 | 230 | @()startRecording(eT); |
|
254 | 265 | fixExitFcn = [ fixExitFcn; {@()changeSet(stims, 3)} ]; |
255 | 266 | end |
256 | 267 |
|
| 268 | +%====================================================TARGET STIMULUS |
257 | 269 | %what to run when we enter the stim presentation state |
258 | 270 | stimEntryFcn = { |
259 | 271 | @()doStrobe(me,true); |
|
276 | 288 | @()doStrobe(me,true); |
277 | 289 | }; |
278 | 290 |
|
| 291 | +%====================================================DECISION |
| 292 | + |
279 | 293 | %if the subject is correct (small reward) |
280 | 294 | correctEntryFcn = { |
281 | 295 | @()timedTTL(rM, tS.rewardPin, tS.rewardTime); % send a reward TTL |
|
0 commit comments