Commit db90d6c8 authored by Julian Kosciessa's avatar Julian Kosciessa
Browse files

final state MR version YA; timestamp 171024

parent 7793d825
%% initialize
if ispc
pn.root = ['D:',filesep,'Dokumente und Einstellungen',filesep,'guest',filesep,'Desktop',filesep,'StateSwitchMR',filesep,'C_Paradigm',filesep];
else
disp('Setup no supported.');
pn.root = ['/Users/kosciessa/Desktop/StateSwitchMR/C_Paradigm/'];
end
pn.CB = [pn.root, 'checker',filesep]; addpath(pn.CB);
pn.MAT = [pn.root, 'dotsx',filesep]; addpath(pn.MAT);
pn.SS = [pn.root, 'StateSwitch',filesep]; addpath(pn.SS);
pn.Stroop = [pn.root, 'Stroop',filesep]; addpath(pn.Stroop);
addpath(genpath([pn.root, 'functions',filesep]));
addpath(genpath([pn.root, 'helper',filesep]));
if ispc
addpath(['C:',filesep,'toolbox',filesep,'Psychtoolbox']); % PTB 3.0.11
else
addpath(genpath('/Users/Shared/Psychtoolbox/')); % PTB 3.0.13 (160606)
end
if ispc
Screen('Preference', 'SkipSyncTests', 0);
else
Screen('Preference', 'SkipSyncTests', 1);
oldLevel = Screen('Preference', 'Verbosity', 4); % output debugging info
PsychDebugWindowConfiguration(0,0.3)
end
%% pre-randomize data for MR experiment
for ind1 = 1:2
for ind2 = 1:3
for ind3 = 1:99
if numel(num2str(ind3)) == 1
ind3_conv = ['0', num2str(ind3)];
else ind3_conv = num2str(ind3);
end
ID = [num2str(ind1), num2str(ind2), ind3_conv]; disp(ID);
% create randomization
expInfo = []; expInfo = eval(['StateSwitch_createExpInfo_dynamic_170922']);
% save randomization
save([pn.root,'expInfo_MR/', ID, '_expInfo.mat'], 'expInfo');
end
end
end
% TO DO: indicate correct keys
\ No newline at end of file
function StateSwitch_addSurroundingCues_dynamic(expInfo, screenInfo, indRun, indBlock, indTrial)
% adds the surrounding cues for the next flip
for indAtt = 1:4
CueImg = ['img',filesep, expInfo.MAT.attNames{indAtt},'Q.png'];
[cueLoad,~,~] = imread(CueImg);
cue2Disp = Screen('MakeTexture',screenInfo.curWindow,cueLoad);
smallIm = [0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)];
switch indAtt
case 1
smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], [0 0 screenInfo.screenRect(3)/2 screenInfo.screenRect(4)/2]);
case 2
smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], [screenInfo.screenRect(3)/2 0 screenInfo.screenRect(3) screenInfo.screenRect(4)/2]);
case 3
smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], [0 screenInfo.screenRect(4)/2 screenInfo.screenRect(3)/2 screenInfo.screenRect(4)]);
case 4
smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], [screenInfo.screenRect(3)/2 screenInfo.screenRect(4)/2 screenInfo.screenRect(3) screenInfo.screenRect(4)]);
end
if ismember(indAtt, expInfo.AttCuesRun{indRun}{indBlock,indTrial})
Screen('DrawTexture', screenInfo.curWindow, cue2Disp, [], smallIm); % draw the object
end
end
end
\ No newline at end of file
......@@ -10,7 +10,7 @@ function StateSwitch_addSurroundingCues_dynamic_170911(expInfo, screenInfo, indR
[cueLoad,~,~] = imread(CueImg);
cue2Disp = Screen('MakeTexture',screenInfo.curWindow,cueLoad);
posScale1 = 10;
posScale2 = 8;
posScale2 = 7; % use 7 for MR, use 8 for EEG
smallIm = [0 0 floor(posScale1*size(cueLoad,2)) floor(posScale2*size(cueLoad,1))];
x1 = screenInfo.screenRect(3);
x2 = screenInfo.screenRect(4);
......
function StateSwitch_addSurroundingCues_words(expInfo, screenInfo, indRun, indBlock, indTrial)
% adds the surrounding cues for the next flip
% expInfo.Cues = {'Tier?'; 'einsilbig?'; 'gerade?'; 'H?'};
for indAtt = 1:4
switch indAtt
case 1
smallIm = [0 0 screenInfo.screenRect(3)/2 screenInfo.screenRect(4)/2];
case 2
smallIm = [screenInfo.screenRect(3)/2 0 screenInfo.screenRect(3) screenInfo.screenRect(4)/2];
case 3
smallIm = [0 screenInfo.screenRect(4)/2 screenInfo.screenRect(3)/2 screenInfo.screenRect(4)];
case 4
smallIm = [screenInfo.screenRect(3)/2 screenInfo.screenRect(4)/2 screenInfo.screenRect(3) screenInfo.screenRect(4)];
end
if ismember(indAtt, expInfo.AttCuesRun{indRun}{indBlock,indTrial})
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
DrawFormattedText(screenInfo.curWindow, expInfo.Cues{indAtt}, 'center', 'center', [], [], [],[],[],[],smallIm);
Screen('TextSize', screenInfo.curWindow, oldTextSize); clear oldTextSize;
end
end
end
\ No newline at end of file
% 171023 | located the word cues centrally
function StateSwitch_addSurroundingCues_words_171023(expInfo, screenInfo, indRun, indBlock, indTrial)
% adds the surrounding cues for the next flip
% expInfo.Cues = {'Tier?'; 'einsilbig?'; 'gerade?'; 'H?'};
for indAtt = 1:4
posScale1 = 10;
posScale2 = 7; % use 7 for MR, use 8 for EEG
x1 = screenInfo.screenRect(3);
x2 = screenInfo.screenRect(4);
coords(1,:) = [.5*x1-(1/posScale1)*x1, .5*x2-(1/posScale2)*x2, .5*x1, .5*x2];
coords(2,:) = [.5*x1, .5*x2-(1/posScale2)*x2, .5*x1+(1/posScale1)*x1, .5*x2];
coords(3,:) = [.5*x1-(1/posScale1)*x1, .5*x2, .5*x1, .5*x2+(1/posScale2)*x2];
coords(4,:) = [.5*x1, .5*x2, .5*x1+(1/posScale1)*x1, .5*x2+(1/posScale2)*x2];
% switch indAtt
% case 1
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(1,:));
% case 2
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(2,:));
% case 3
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(3,:));
% case 4
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(4,:));
% end
if ismember(indAtt, expInfo.AttCuesRun{indRun}{indBlock,indTrial})
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
DrawFormattedText(screenInfo.curWindow, expInfo.Cues{indAtt}, 'center', 'center', [], [], [],[],[],[],coords(indAtt,:));
Screen('TextSize', screenInfo.curWindow, oldTextSize); clear oldTextSize;
end
end
end
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -20,8 +20,9 @@
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 170911 - altered timing, added postcuefix
% 171004 - replaced repelem with version working on older MATLAB versions
function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
function expInfo = StateSwitch_createExpInfo_dynamic_TEST_171004(dim)
expInfo.trialsPerAtt = 16; % number of trials within state order & attribute (half of this for each choice)
expInfo.numOfAtt = 4; % number of attributes to be included
......@@ -299,7 +300,7 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
if ismember(indOrd, [2:4])
for indSplit = 1:numel(Splits)
check = 0;
while check == 0 % try to find pseudo-randomization that works
while check == 0 % try to find pseudo-randomization that works
try
% pseudo-randomize to start block with no-switch
% have a maximum of 3 repetitions (i.e. 4 identical trials)
......@@ -316,14 +317,22 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
end
% fill with attributes
if indOrd == 4
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
elseif indOrd == 3
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==2);
elseif indOrd == 2
availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
A = 1:4;
R = numel(Splits{indSplit})/2.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
end
......
......@@ -16,8 +16,9 @@
% 170816 - created word randomization version, deleted dot entries
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 171023 - replaced repelem with version working on older MATLAB versions
function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
function expInfo = StateSwitch_createExpInfo_words_171023(varargin)
% load wordlists
try
......@@ -32,14 +33,14 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
expInfo.totalTrials = expInfo.trialsPerAtt*expInfo.numOfAtt*expInfo.numOrders;
expInfo.durBlockOnset = 5; % duration of block onset
expInfo.durFixCue = 3; % duration of fixcross with cues
expInfo.durCue = 0; % duration of cue
expInfo.durPres = 2; % duration of presentation
expInfo.durFixCue = 3.5; % duration of fixcross with cues
expInfo.durCue = 1; % duration of cue
expInfo.durPres = 2.5; % duration of presentation
expInfo.durResp = 0; % duration of question
expInfo.durConf = 0; % duration of confidence
expInfo.durReward = 3; % duration of reward
expInfo.durITI = 2; % duration of ITI
expInfo.CTsim = 'yes'; % simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
expInfo.CTsim = 'no'; % simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'relative';
......@@ -84,31 +85,20 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
%% specify keys
% Use OS X keyboard naming scheme across all plattforms
% Otherwise LeftControl/RightControl are not recognized
% Otherwise LeftControl/RightControl are not recognized
KbName('UnifyKeyNames');
if ismac % Mac keyboard
expInfo.keyLeft = [KbName('LeftControl'), KbName('LeftAlt'), KbName('LeftArrow')]; % left response
expInfo.keyRight = [KbName('RightControl'), KbName('RightAlt'), KbName('RightArrow')]; % right response
expInfo.keyConf1 = [KbName('LeftControl'), KbName('LeftArrow')]; % lowest confidence
expInfo.keyConf2 = KbName('LeftAlt'); % intermediate confidence low
expInfo.keyConf3 = KbName('RightAlt'); % intermediate confidence high
expInfo.keyConf4 = [KbName('RightControl'), KbName('RightArrow')]; % highest confidence
else % PC keyboard
% expInfo.keyLeft = KbName('LeftControl');
% expInfo.keyRight = KbName('RightControl');
expInfo.keyLeft = [KbName('LeftControl'), KbName('LeftAlt'), KbName('LeftArrow')];
expInfo.keyRight = [KbName('RightControl'), KbName('RightAlt'), KbName('RightArrow')];
expInfo.keyConf1 = [KbName('LeftControl'), KbName('LeftArrow')];
expInfo.keyConf2 = KbName('LeftAlt');
expInfo.keyConf3 = KbName('RightAlt');
expInfo.keyConf4 = [KbName('RightControl'), KbName('RightArrow')];
end
expInfo.keyLeft = [KbName('LeftControl'), KbName('LeftAlt'), KbName('LeftArrow'), KbName('1!'),KbName('2@'), KbName('b'), KbName('z')]; % left response
expInfo.keyRight = [KbName('RightControl'), KbName('RightAlt'), KbName('RightArrow'),KbName('6^'),KbName('7&'),KbName('g'), KbName('r')]; % right response
expInfo.keyConf1 = [KbName('LeftControl'), KbName('LeftArrow'), KbName('1!'),KbName('b')]; % lowest confidence
expInfo.keyConf2 = [KbName('LeftAlt'), KbName('2@'),KbName('z')]; % intermediate confidence low
expInfo.keyConf3 = [KbName('RightAlt'),KbName('6^'),KbName('g')]; % intermediate confidence high
expInfo.keyConf4 = [KbName('RightControl'), KbName('RightArrow'),KbName('7&'), KbName('r')]; % highest confidence
expInfo.keyModifier = KbName('LeftAlt'); % to prevent accidental input
expInfo.keyEscape = KbName('Escape'); %
expInfo.keyReturn = KbName('Return'); % continue experiment
expInfo.keyPause = KbName('p');
expInfo.keyEscape = KbName('Escape'); %
expInfo.keyReturn = [KbName('Return'), KbName('7&'), KbName('g'), KbName('r')]; % continue experiment
expInfo.keyPause = KbName('p');
% g,r - left; b,z- right (blue does not work)
%% randomize stimuli and non-target duration
......@@ -269,14 +259,22 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
end
% fill with attributes
if indOrd == 4
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
elseif indOrd == 3
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==2);
elseif indOrd == 2
availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
A = 1:4;
R = numel(Splits{indSplit})/2.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
end
......
......@@ -17,12 +17,14 @@
% 170821 - created practice version
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 171023 - replaced repelem with version working on older MATLAB versions
% - draw stimuli from separate practice set
function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
function expInfo = StateSwitch_createExpInfo_words_TEST_171023(dim)
% load wordlists
try
load('stimuliSelected.mat')
load('stimuliSelected_practice.mat')
catch
warning('Stimuli not found, please check path.')
end
......@@ -33,14 +35,14 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
expInfo.totalTrials = expInfo.trialsPerAtt*expInfo.numOfAtt*expInfo.numOrders;
expInfo.durBlockOnset = 5; % duration of block onset
expInfo.durFixCue = 3; % duration of fixcross with cues
expInfo.durCue = 0; % duration of cue
expInfo.durPres = 2; % duration of presentation
expInfo.durFixCue = 3.5; % duration of fixcross with cues
expInfo.durCue = 1; % duration of cue
expInfo.durPres = 2.5; % duration of presentation
expInfo.durResp = 0; % duration of question
expInfo.durConf = 0; % duration of confidence
expInfo.durReward = 0; % duration of reward
expInfo.durReward = 3; % duration of reward
expInfo.durITI = 2; % duration of ITI
expInfo.CTsim = 'yes';
expInfo.CTsim = 'no'; % simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'relative';
......@@ -77,16 +79,18 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
% Use OS X keyboard naming scheme across all plattforms
% Otherwise LeftControl/RightControl are not recognized
KbName('UnifyKeyNames');
expInfo.keyLeft = [KbName('LeftControl'), KbName('LeftAlt'), KbName('LeftArrow'), KbName('1!'),KbName('2@')]; % left response
expInfo.keyRight = [KbName('RightControl'), KbName('RightAlt'), KbName('RightArrow'),KbName('6^'),KbName('7&')]; % right response
expInfo.keyConf1 = [KbName('LeftControl'), KbName('LeftArrow'), KbName('1!')]; % lowest confidence
expInfo.keyConf2 = [KbName('LeftAlt'), KbName('2@')]; % intermediate confidence low
expInfo.keyConf3 = [KbName('RightAlt'),KbName('6^')]; % intermediate confidence high
expInfo.keyConf4 = [KbName('RightControl'), KbName('RightArrow'),KbName('7&')]; % highest confidence
expInfo.keyLeft = [KbName('LeftControl'), KbName('LeftAlt'), KbName('LeftArrow'), KbName('1!'),KbName('2@'), KbName('b'), KbName('z')]; % left response
expInfo.keyRight = [KbName('RightControl'), KbName('RightAlt'), KbName('RightArrow'),KbName('6^'),KbName('7&'),KbName('g'), KbName('r')]; % right response
expInfo.keyConf1 = [KbName('LeftControl'), KbName('LeftArrow'), KbName('1!'),KbName('b')]; % lowest confidence
expInfo.keyConf2 = [KbName('LeftAlt'), KbName('2@'),KbName('z')]; % intermediate confidence low
expInfo.keyConf3 = [KbName('RightAlt'),KbName('6^'),KbName('g')]; % intermediate confidence high
expInfo.keyConf4 = [KbName('RightControl'), KbName('RightArrow'),KbName('7&'), KbName('r')]; % highest confidence
expInfo.keyModifier = KbName('LeftAlt'); % to prevent accidental input
expInfo.keyEscape = KbName('Escape'); %
expInfo.keyReturn = [KbName('Return'), KbName('7&')]; % continue experiment
expInfo.keyReturn = [KbName('Return'), KbName('7&'), KbName('g'), KbName('r')]; % continue experiment
expInfo.keyPause = KbName('p');
% g,r - left; b,z- right (blue does not work)
%% randomize stimuli and non-target duration
......@@ -247,14 +251,22 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
end
% fill with attributes
if indOrd == 4
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
elseif indOrd == 3
availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
A = 1:4;
R = 4.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==2);
elseif indOrd == 2
availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
A = 1:4;
R = numel(Splits{indSplit})/2.*extractMat(indSplit,:);
availableOptions = cell2mat(arrayfun(@(a,r)repmat(a,1,r),A,R,'uni',0));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon = find(extractMat(indSplit,:)==1);
mostCommon = mostCommon(1);
end
......
This diff is collapsed.
This diff is collapsed.
......@@ -19,8 +19,9 @@
% 170814 | added triggers (MR, EEG, ET); turned into run version
% 170816 | adapted to multiple task variants
% 170816 | included RT feedback + reward at end of each block
% 171023 | removed peripheral word cues during presentation
function StateSwitch_experiment_170911(expInfo, setup)
function StateSwitch_experiment_171023(expInfo, setup)
%%
%% sanitize function parameters
......@@ -65,9 +66,21 @@ function StateSwitch_experiment_170911(expInfo, setup)
end
end
if setup.MR.useMR == 1
textSizeLow = 15;
textSizeHigh = 30;
else
textSizeLow = 30;
textSizeHigh = 30;
end
%% set behavioural data savepath
sessionFile = [setup.subjectsPath, setup.subj, '_StateSwitch_',setup.task,'_', datestr(now, 'yymmdd_HHMM'), '.mat'];
if setup.MR.useMR == 1
sessionFile = [setup.subjectsPath, setup.subj, '_StateSwitchMR_',setup.task,'_', datestr(now, 'yymmdd_HHMM'), '.mat'];
else
sessionFile = [setup.subjectsPath, setup.subj, '_StateSwitch_',setup.task,'_', datestr(now, 'yymmdd_HHMM'), '.mat'];
end
%% set up PTB
......@@ -92,7 +105,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
HideCursor(screenInfo.curWindow);
end
Screen('TextFont', screenInfo.curWindow, 'Helvetica');
Screen('TextSize', screenInfo.curWindow, 20);
Screen('TextSize', screenInfo.curWindow, textSizeLow);
Screen('TextStyle', screenInfo.curWindow, 0); % regular
Screen('TextColor', screenInfo.curWindow, 255); % white
ifi = Screen('GetFlipInterval', screenInfo.curWindow); % Query the frame duration
......@@ -107,13 +120,14 @@ function StateSwitch_experiment_170911(expInfo, setup)
screenInfo.keyboard_exp = max(keyboardIndices);
else disp('Check setup: only 1 or 2 keyboards supported.');
end
ListenChar(2);
% Do dummy calls to GetSecs, WaitSecs, KbCheck(-1) to make sure
% they are loaded and ready when we need them - without delays
% in the wrong moment:
% KbCheck(-1);
% WaitSecs(0.1);
% GetSecs;
KbCheck(-1);
WaitSecs(0.1);
GetSecs;
%% startup ET
......@@ -138,12 +152,12 @@ function StateSwitch_experiment_170911(expInfo, setup)
%% run loop
for indRun = 1:expInfo.runAmount
for indRun = setup.StartRunOn:expInfo.runAmount
if setup.ET.useET
Screen('TextSize', screenInfo.curWindow, 20);
Screen('TextSize', screenInfo.curWindow, textSizeLow);
DrawFormattedText(screenInfo.curWindow, ...
'Wir werden nun den Eyetracker konfigurieren. \n\n Bitte fixieren Sie zunchst die weien, hohlen Kreise, die auf dem Bildschirm auftauchen.', ...
'Wir werden nun den Eyetracker konfigurieren. \n\n Bitte fixieren Sie zunchst die grauen Kreise, \n\n die auf dem Bildschirm auftauchen.', ...
'center', 'center', [255 255 255 255]);
Screen('Flip',screenInfo.curWindow);
while true
......@@ -199,7 +213,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
% change textcolor to white
Screen('TextColor', screenInfo.curWindow, [255 255 255]);
% put Ready... on the screen and wait for user presses Return
DrawFormattedText(screenInfo.curWindow, 'Bereit? \n\n Bitte die rechte Taste drcken!', 'center', 'center');
DrawFormattedText(screenInfo.curWindow, 'Bereit? \n\n Das Experiment startet in Krze ...!', 'center', 'center');
Screen('Flip', screenInfo.curWindow);
while true
[exitSession, resumeSession] = checkKeys_byKeyB(expInfo, screenInfo.keyboard_sub);
......@@ -215,15 +229,15 @@ function StateSwitch_experiment_170911(expInfo, setup)
end
end
if setup.MR.useMR % wait for scanner pulse to start exp
DrawFormattedText(screenInfo.curWindow, 'Waiting for scanner pulse','center','center', WhiteIndex(w))
if setup.MR.useMR==1 && setup.MR.dummy==0 % wait for scanner pulse to start exp
DrawFormattedText(screenInfo.curWindow, 'Waiting for scanner pulse','center','center', [255 255 255])
Screen('Flip', screenInfo.curWindow);
try
scannerPort = 888;
triggerSwitches = 17; % TR of experiment onset; wait for 17th TR (at TR of .625s, this should allow for 10s of equilibration)
[SCAN t0] = fMRI_waitScannerTriggers(scannerPort, irun, triggerSwitches, []);
[SCAN t0] = fMRI_waitScannerTriggers(scannerPort, indRun, triggerSwitches, []);
t0 = GetSecs;
Eyelink('Message', sprintf('Run%d fMRI scanning Start time %g', irun, t0));
Eyelink('Message', sprintf('Run%d fMRI scanning Start time %g', indRun, t0));
catch
warning('MR Triggers not working!!')
end
......@@ -244,11 +258,11 @@ function StateSwitch_experiment_170911(expInfo, setup)
if strcmp(setup.task, 'dynamic')
StateSwitch_addSurroundingCues_dynamic_170911(expInfo, screenInfo, indRun, indBlock, 1);
elseif strcmp(setup.task, 'words')
StateSwitch_addSurroundingCues_words(expInfo, screenInfo, indRun, indBlock, 1);
StateSwitch_addSurroundingCues_words_171023(expInfo, screenInfo, indRun, indBlock, 1);
elseif strcmp(setup.task, 'visual')
StateSwitch_addSurroundingCues_visual(expInfo, screenInfo, indRun, indBlock, 1);
end
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
oldTextSize = Screen('TextSize', screenInfo.curWindow, textSizeLow);
DrawFormattedText(screenInfo.curWindow, ['relevante Attribute: ', num2str(expInfo.StateOrderRun{indRun}(indBlock,1))], 'center', 'center');
Screen('TextSize', screenInfo.curWindow, oldTextSize); clear oldTextSize;
......@@ -314,7 +328,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
ExperimentProtocol,ResultMat,DisplayInfo,Timing,setup, dio);
elseif strcmp(setup.task, 'words') || strcmp(setup.task, 'visual')
[~, expInfo, ExperimentProtocol,ResultMat,DisplayInfo,Timing] = ...
StateSwitch_trialPresentation_words_visual_170829(screenInfo, expInfo, [], indRun, indBlock, indTrial, ...
StateSwitch_trialPresentation_words_visual_171023(screenInfo, expInfo, [], indRun, indBlock, indTrial, ...
ExperimentProtocol,ResultMat,DisplayInfo,Timing,setup, dio);
end
% ------------------------------------------------------------------------------
......@@ -340,18 +354,18 @@ function StateSwitch_experiment_170911(expInfo, setup)
% select random trial to be compared
RTfeedb.rndChoice = RTfeedb.lastRTs(randperm(expInfo.blockLengthDim,1));
if ~isnan(RTfeedb.rndChoice) & RTfeedb.rndChoice >= RTfeedb.curMdRT-expInfo.RTfeedback.slack
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
oldTextSize = Screen('TextSize', screenInfo.curWindow, textSizeHigh);
DrawFormattedText(screenInfo.curWindow, ['Schnell genug! \n\n +', num2str(expInfo.RTfeedback.reward), ' cent'], 'center', 'center', [0 255 0]);
else
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
oldTextSize = Screen('TextSize', screenInfo.curWindow, textSizeHigh);
DrawFormattedText(screenInfo.curWindow, ['Nicht schnell genug! \n\n ', num2str(expInfo.RTfeedback.loss), ' cent'], 'center', 'center', [255 0 0]);
end
elseif strcmp(expInfo.RTfeedback.type, 'fixed')
if expInfo.RTfeedback.fixedFeedback(indRun,indBlock) == 1
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
oldTextSize = Screen('TextSize', screenInfo.curWindow, textSizeHigh);
DrawFormattedText(screenInfo.curWindow, ['Schnell genug! \n\n +', num2str(expInfo.RTfeedback.reward), ' cent'], 'center', 'center', [0 255 0]);
elseif expInfo.RTfeedback.fixedFeedback(indRun,indBlock) == 0
oldTextSize = Screen('TextSize', screenInfo.curWindow, 30);
oldTextSize = Screen('TextSize', screenInfo.curWindow, textSizeHigh);
DrawFormattedText(screenInfo.curWindow, ['Nicht schnell genug! \n\n ', num2str(expInfo.RTfeedback.loss), ' cent'], 'center', 'center', [255 0 0]);
end
end
......@@ -441,7 +455,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
end
% have the subject get ready for the next condition
pause(.1);
remain = expInfo.breakTime-round(GetSecs - Timing.PauseStart,0);
remain = expInfo.breakTime-round(GetSecs - Timing.PauseStart);
if indRun == expInfo.runAmount
DrawFormattedText(screenInfo.curWindow, ['Sie haben das Experiment beendet. \n\n Wir speichern nun Ihre Antworten.'], 'center', 'center');
if (GetSecs()-Timing.PauseStart) >= 15
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -62,13 +62,6 @@ function StateSwitch_resting_170829(setup)
GetSecs;
%% session start info
Timing.sessStart