Skip to content

Commit

Permalink
more doc and protocol improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
iandol committed Feb 27, 2022
1 parent b78047a commit 96ee577
Show file tree
Hide file tree
Showing 23 changed files with 687 additions and 210 deletions.
Binary file modified CoreProtocols/AreaSummationDots.mat
Binary file not shown.
5 changes: 3 additions & 2 deletions CoreProtocols/AreaSummationStateInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,10 @@
'prefix' 'fixate' 0.5 prefixEntryFcn prefixFcn [] prefixExitFcn;
'fixate' 'incorrect' 5 fixEntryFcn fixFcn inFixFcn fixExitFcn;
'stimulus' 'incorrect' 5 stimEntryFcn stimFcn maintainFixFcn stimExitFcn;
'incorrect' 'prefix' 3 incEntryFcn incFcn [] incExitFcn;
'breakfix' 'prefix' tS.tOut breakEntryFcn incFcn [] incExitFcn;
'incorrect' 'prefix' 0.5 incEntryFcn incFcn [] incExitFcn;
'breakfix' 'prefix' 0.5 breakEntryFcn incFcn [] incExitFcn;
'correct' 'prefix' 0.5 correctEntryFcn correctFcn [] correctExitFcn;
'timeout' 'prefix' tS.tOut {} {} {} {};
'calibrate' 'pause' 0.5 calibrateFcn [] [] [];
'drift' 'pause' 0.5 driftFcn [] [] [];
'override' 'pause' 0.5 overrideFcn [] [] [];
Expand Down
Binary file modified CoreProtocols/FastXYRFMapper.mat
Binary file not shown.
Binary file modified CoreProtocols/OrientationTuning.mat
Binary file not shown.
4 changes: 2 additions & 2 deletions CoreProtocols/Saccade_AntiSaccadeStateInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
% updateTask() for correct responses. 'false' is useful during training.
tS.includeErrors = false;
% is this run a 'saccade' or 'anti-saccade' task run?
tS.type = 'anti-saccade';
tS.type = 'saccade';
if strcmpi(tS.type,'saccade')
% a flag to conditionally set visualisation on the eye tracker interface
stims{1}.showOnTracker = true;
Expand All @@ -53,7 +53,7 @@
% anti-saccade target towards to place where the pro-saccade target is, so
% starting training keeping the pro-saccade target visible helps the
% subject understand the task
tS.targetAlpha = 0.15;
tS.targetAlpha = 0.1;
end

%==================================================================
Expand Down
Binary file modified CoreProtocols/Twostep_Saccade.mat
Binary file not shown.
73 changes: 31 additions & 42 deletions CoreProtocols/Twostep_Saccade_StateInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
% we use taskSequence to randomise which state to switch to (independent
% trial-level factor). The idea is we we call
% @()updateNextState(me,'trial') in the prefixation state; this sets one of
% these two trialVar.values as the next state. The fixateOS and fixateTS
% these two trialVar.values as the next state. The fix1Step and fix2Step
% states will then call onestep or twostep stimulus states. Therefore we can
% call different experiment structures based on this trial-level factor.
task.trialVar.values = {'fixateOS','fixateTS'};
task.trialVar.probability = [0.6 0.4];
%task.trialVar.values = {'fix1Step','fix2Step'};
%task.trialVar.probability = [0.6 0.4];
task.trialVar.comment = 'one or twostep trial based on 60:40 probability';
tL.stimStateNames = {'onestep','twostep'};

Expand Down Expand Up @@ -144,15 +144,8 @@
% experiments use taskSequence to define proper randomised and balanced
% variable sets and triggers to send to recording equipment etc...
%
% stims.choice = [];
% n = 1;
% in(n).name = 'xyPosition';
% in(n).values = [6 6; 6 -6; -6 6; -6 -6; -6 0; 6 0];
% in(n).stimuli = 1;
% in(n).offset = [];
% stims.stimulusTable = in;
stims.choice = [];
stims.stimulusTable = [];
stims.choice = [];

%==================================================================
%-------------allows using arrow keys to control variables?-------------
Expand Down Expand Up @@ -250,7 +243,9 @@
@()trackerDrawFixation(eT); % draw fixation window on eyetracker display
@()trackerDrawStimuli(eT,stims.stimulusPositions); %draw location of stimulus on eyetracker
@()needEyeSample(me,true); % make sure we start measuring eye position
@()updateNextState(me,'trial'); % we use the trial/block factor in task to select which state to transition to next
% IMPORTANT! updateNextState uses the trial/block factor in task to select
% which state to transition to next
@()updateNextState(me,'trial');
};

%====================================================ONESTEP FIXATION + STIMULATION
Expand Down Expand Up @@ -376,12 +371,12 @@

%when we exit the correct state
correctExitFcn = {
@()updatePlot(bR, me); %update our behavioural plot
@()updateTask(me,tS.CORRECT); %make sure our taskSequence is moved to the next trial
@()updateVariables(me); %randomise our stimuli, and set strobe value too
@()update(stims); %update our stimuli ready for display
@()getStimulusPositions(stims); %make a struct the eT can use for drawing stim positions
@()resetExclusionZones(eT); %reset the exclusion zones
@()updatePlot(bR, me); %update our behavioural plot
@()drawnow;
@()checkTaskEnded(me); %check if task is finished
};
Expand All @@ -405,11 +400,11 @@

%incorrect / break exit
incExitFcn = {
@()updatePlot(bR, me); %update our behavioural plot, must come before updateTask() / updateVariables()
@()updateVariables(me); %randomise our stimuli, don't run updateTask(task), and set strobe value too
@()update(stims); %update our stimuli ready for display
@()getStimulusPositions(stims); %make a struct the eT can use for drawing stim positions
@()resetExclusionZones(eT); %reset the exclusion zones
@()updatePlot(bR, me); %update our behavioural plot, must come before updateTask() / updateVariables()
@()drawnow;
@()checkTaskEnded(me); %check if task is finished
};
Expand Down Expand Up @@ -477,12 +472,6 @@
@()flashScreen(s, 0.2) % fullscreen flash mode for visual background activity detection
};

%magstim, can only be triggered from keyboard
magstimFcn = {
@()drawBackground(s);
@()stimulate(mS); % run the magstim
};

%show 1deg size grid
gridFcn = {
@()drawBackground(s); %blank the display
Expand All @@ -493,32 +482,32 @@
@()drawGrid(s);
};

%==============================================================================
%----------------------State Machine Table-------------------------
disp('================>> Building state info file <<================')
%specify our cell array that is read by the stateMachine
% specify our cell array that is read by the stateMachine
stateInfoTmp = {
'name' 'next' 'time' 'entryFcn' 'withinFcn' 'transitionFcn' 'exitFcn';
'pause' 'prefix' inf pauseEntryFcn [] [] pauseExitFcn;
'prefix' 'UseTemp' 2 prefixEntryFcn prefixFcn [] prefixExitFcn;
'fixateOS' 'incorrect' 5 fixOSEntryFcn fixOSFcn inFixOSFcn fixOSExitFcn;
'fixateTS' 'incorrect' 5 fixTSEntryFcn fixTSFcn inFixTSFcn fixTSExitFcn;
'pause' 'prefix' inf pauseEntryFcn {} {} pauseExitFcn;
'prefix' 'UseTemp' 2 prefixEntryFcn prefixFcn {} prefixExitFcn;
'fix1Step' 'incorrect' 5 fixOSEntryFcn fixOSFcn inFixOSFcn fixOSExitFcn;
'fix2Step' 'incorrect' 5 fixTSEntryFcn fixTSFcn inFixTSFcn fixTSExitFcn;
'onestep' 'incorrect' 5 osEntryFcn osFcn maintainFixFcn sExitFcn;
'twostep' 'incorrect' 5 tsEntryFcn tsFcn maintainFixFcn sExitFcn;
'incorrect' 'prefix' 3 incEntryFcn incFcn [] incExitFcn;
'breakfix' 'prefix' tS.tOut breakEntryFcn incFcn [] incExitFcn;
'exclusion' 'prefix' tS.tOut exclEntryFcn incFcn [] incExitFcn;
'correct' 'prefix' 0.5 correctEntryFcn correctFcn [] correctExitFcn;
'useTemp' 'prefix' 0.5 [] [] [] [];
'calibrate' 'pause' 0.5 calibrateFcn [] [] [];
'drift' 'pause' 0.5 driftFcn [] [] [];
'override' 'pause' 0.5 overrideFcn [] [] [];
'flash' 'pause' 0.5 flashFcn [] [] [];
'magstim' 'prefix' 0.5 [] magstimFcn [] [];
'showgrid' 'pause' 10 [] gridFcn [] [];
'incorrect' 'timeout' 0.5 incEntryFcn incFcn {} incExitFcn;
'breakfix' 'timeout' 0.5 breakEntryFcn incFcn {} incExitFcn;
'exclusion' 'timeout' 0.5 exclEntryFcn incFcn {} incExitFcn;
'correct' 'prefix' 0.5 correctEntryFcn correctFcn {} correctExitFcn;
'useTemp' 'prefix' 0.5 {} {} {} {};
'timeout' 'prefix' tS.tOut {} {} {} {};
'calibrate' 'pause' 0.5 calibrateFcn {} {} {};
'drift' 'pause' 0.5 driftFcn {} {} {};
'override' 'pause' 0.5 overrideFcn {} {} {};
'flash' 'pause' 0.5 flashFcn {} {} {};
'showgrid' 'pause' 10 {} gridFcn {} {};
};

%----------------------State Machine Table-------------------------
%==============================================================================
disp('================>> Building state info file <<================')
disp(stateInfoTmp)
disp('================>> Loaded state info file <<================')
clear pauseEntryFcn fixEntryFcn fixFcn inFixFcn fixExitFcn stimFcn maintainFixFcn incEntryFcn ...
incFcn incExitFcn breakEntryFcn breakFcn correctEntryFcn correctFcn correctExitFcn ...
calibrateFcn overrideFcn flashFcn gridFcn
disp('=================>> Loaded state info file <<=================')
clearvars -regexp '.+Fcn$' % clear the cell array Fcns in the current workspace
74 changes: 40 additions & 34 deletions DefaultStateInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@
%> fixation [inFixFcn], and for stimulus there is a check if the subject
%> maintains fixation for an additional time [maintainFixfcn].
%>
%> ┌───────────────────────────────────────┐
%> │ ▼
%> │ ┌───────────────────────────┐
%> ┌──┼───────────────────────────────────▶ │ prefix │ ◀┐
%> │ │ └───────────────────────────┘ │
%> │ │ │ │
%> │ │ ▼ │
%> │┌───────────┐ Transition ┌───────────────────────────┐ │
%> ││ incorrect │ inFixFcn=>incorrect │ fixate │ │
%> ││ │◀───────────────────────── │ show(stims, 2) │ │
%> │└───────────┘ └───────────────────────────┘ │
%> │ │ │
%> │ │ Transition │
%> └──┐ │ inFixFcn=>stimulus │
%> │ ▼ │
%> ┌───────────┐ Transition ┌───────────────────────────┐ │
%> │ CORRECT │ maintainFixFcn=>correct │ stimulus │ │
%> │ │◀───────────────────────── │ show(stims, [1 2]) │ │
%> └───────────┘ └───────────────────────────┘ │
%> │ │
%> │ Transition │
%> │ maintainFixFcn=>breakfix │
%> ▼ │
%> ┌───────────────────────────┐ │
%> │ BREAKFIX │ ─┘
%> └───────────────────────────┘
%> ┌───────────────────┐
%> │ prefix │
%> ┌──────────────────────────────────────────────────▶ │ hide(stims) │ ◀┐
%> │ └───────────────────┘ │
%> │ │ │
%> │ ▼ │
%> │ ┌───────────┐ inFixFcn: ┌───────────────────┐ │
%> │ │ incorrect │ incorrect │ fixate │ │
%> │ │ │ ◀─────────── │ show(stims,2) │ │
%> │ └───────────┘ └───────────────────┘ │
%> │ │ │ inFixFcn: │
%> │ reward! │ │ stimulus │
%> │ │ ▼ │
%>┌─────────┐ maintainFixFcn: │ ┌───────────────────┐ │
%>│ correct │ correct │ │ stimulus │ │
%>│ │ ◀─────────────────┼─────────────────────── │ show(stims,[1 2]) │ │
%>└─────────┘ │ └───────────────────┘ │
%> │ │ maintainFixFcn: │
%> │ │ breakfix │
%> │ ▼ │
%> │ ┌───────────────────┐ │
%> │ │ breakfix │ │
%> │ └───────────────────┘ │
%> │ │ │
%> │ ▼ │
%> │ ┌───────────────────┐ │
%> │ │ timeout │ │
%> └──────────────────────▶ │ tS.tOut │ ─┘
%> └───────────────────┘
%>
%> State files control the logic of a behavioural task, switching between
%> states and executing functions on ENTER, WITHIN and on EXIT of states. In
Expand All @@ -48,9 +51,9 @@
%> methods (functions) useful for running the task:
%>
%> me = runExperiment object ('self' in OOP terminology)
%> s = screenManager object
%> s = screenManager object
%> aM = audioManager object
%> stims = our list of stimuli (metaStimulus class)
%> stims = our list of stimuli (metaStimulus class)
%> sM = State Machine (stateMachine class)
%> task = task sequence (taskSequence class)
%> eT = eyetracker manager
Expand Down Expand Up @@ -474,8 +477,11 @@
%--------------------show 1deg size grid
gridFcn = {@()drawGrid(s)};

%==============================================================================
%----------------------State Machine Table-------------------------

%==========================================================================
%==========================================================================
%==========================================================================
%--------------------------State Machine Table-----------------------------
% specify our cell array that is read by the stateMachine
stateInfoTmp = {
'name' 'next' 'time' 'entryFcn' 'withinFcn' 'transitionFcn' 'exitFcn';
Expand All @@ -491,12 +497,12 @@
'drift' 'pause' 0.5 driftFcn {} {} {};
'override' 'pause' 0.5 overrideFcn {} {} {};
'flash' 'pause' 0.5 flashFcn {} {} {};
'magstim' 'prefix' 0.5 {} magstimFcn {} {};
'showgrid' 'pause' 10 {} gridFcn {} {};
};
%----------------------State Machine Table-------------------------
%==============================================================================
disp('================>> Building state info file <<================')
%--------------------------State Machine Table-----------------------------
%==========================================================================

disp('=================>> Built state info file <<==================')
disp(stateInfoTmp)
disp('=================>> Loaded state info file <<=================')
clearvars -regexp '.+Fcn$' % clear the cell array Fcns in the current workspace
Loading

0 comments on commit 96ee577

Please sign in to comment.