123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- global STIM
- %% TIMING ================================================================================
- STIM.PreFixT = 1000; % time to enter fixation window
- STIM.FixT = 200; % time to fix before stim onset
- STIM.KeepFixT = 0; % time to fix before target onset. before 26-9-2014 this was 150
- STIM.ReacT = 2000; % max allowed reaction time (leave fixwin after target onset)
- STIM.SaccT = 2000; % max allowed saccade time (from leave fixwin to enter target win)
- STIM.ErrT = 500; % punishment extra ISI after error trial
- STIM.ISI = 500; % base inter-stimulus interval
- STIM.ISI_RAND = 100; % maximum extra (random) ISI to break any possible rythm
- %% STIMULI ===============================================================================
- % Background
- STIM.BackCol = [0.6 0.6 0.6]; % background color in [R G B] 0-1
- % fixation
- STIM.FixSz = 0.3; % fixation dot size in degrees visual angle
- STIM.FixWinSz = [1.2 1.2]; % oval [width height]
- % diameter of circular area (in deg) around fixation dot center that counts as 'fixation'
- STIM.FixPos = [0 0]; % position of fixation dot [X Y] in deg, relative to center of screen
- STIM.FixCol_NoGo = [1 0 0]; % fixation dot color in [R G B] 0-1 signalling 'hold fixation'
- STIM.FixCol_Go = [0 1 0]; % fixation dot color in [R G B] 0-1 signalling 'go to target'
- % stimulus objects
- % size
- STIM.TarSz = 1.8; % deg
- % window size
- STIM.TarWinSz = [4 4]; % oval [width height]
- %deg, circular area around target center used to detect selection with eye movement
- % Two color schemes because colors can switch in this paradigm
- STIM.ColSchemes(1).TargColCorr =[1 0.65 0.65];%[1 0 0];% [1 0.7 0.7];; % target
- STIM.ColSchemes(1).TargColErr_NonSal = STIM.ColSchemes(1).TargColCorr; % nonsalient nontarget
- STIM.ColSchemes(1).TargColErr_Sal =[0.65 1 0.65];%[0 1 0];%[0.9 0.9 0.7]; %salient nontarget
- STIM.ColSchemes(2).TargColCorr = [0.65 1 0.65];%[0 1 0];
- STIM.ColSchemes(2).TargColErr_NonSal = STIM.ColSchemes(2).TargColCorr;
- STIM.ColSchemes(2).TargColErr_Sal = [1 0.65 0.65];%[1 0 0];
- % probability of switching color-schemes
- STIM.ChanceSwitchColScheme = 0.5;
- % Reward values
- % you can use these for the 'real' Hickey task
- STIM.UseSpecRew = true; % if false, use the reward value from the tracker window
- STIM.RewardValues = [0.070 0.400]; % in seconds that the reward valve will be opened
- STIM.ConsSameRew = 5; % only allow this much consecutive trials with the same reward values
- % Positions
- STIM.PositionsManually = true;
- % If false, only give number of stimuli.
- % They will be equally spaced on a circle around fixation
- % If true, you can manually make the positions match receptive field locations
- if STIM.PositionsManually
- % positions
- % STIM.TarPos = [...
- % -2 -5;...
- % -5.3 -1;...
- % -3.3 4.3;...
- % 2 5;...
- % 5.3 1;...
- % 3.3 -4.3 ];
- STIM.TarPos = [...
- 5 -1;...
- 1.7 -4.8;...
- -3.4 -3.8 ;...%-4.5;...
- -5 1;...
- -1.7 4.8;...
- 3.4 3.8];
- STIM.TarN = size(STIM.TarPos,1);
- else
- % number
- STIM.TarN = 6;
- % distance from fix
- STIM.TarDistFromFix = 5;
- % calculate positions
- StartAngle=0; %Polar angles start at 3 o'clock and move ccw
- STIM.PolarAngles = StartAngle:(2*pi)/(STIM.TarN):StartAngle+2*pi;
- %STIM.PolarAngles = 0:(2*pi)/(STIM.TarN):2*pi;
- %STIM.PolarAngles = STIM.PolarAngles(1:STIM.TarN);
- x=STIM.TarDistFromFix.*cos(STIM.PolarAngles);
- y=STIM.TarDistFromFix.*sin(STIM.PolarAngles);
- STIM.TarPos = [x' y'];
- end
- % target shape (possible)
- % 1 = circle
- % 2 = square
- % [1 2] = circle and square
- STIM.Shapes(1).name ='circle';
- STIM.Shapes(2).name ='rect';
- STIM.TarShapeIncl = [1,2];
- % if circle and square, how should it be set up?
- % [Startshape SwitchEveryNthTrial]
- % StartShape: 1 = circle, 2 = square 0 = random
- % If SwitchEveryNthTrial=0 it's random
- STIM.TarShapeSetup = [0 0];
- %% TRIAL TYPE LIST =================
- STIM.TrialTypes = [];
- for pos = 1:STIM.TarN % position of target (can be anything)
- spos=1:STIM.TarN; % position of salient non-target
- spos(spos==pos)=[]; % can be anything but the target position
- for type = STIM.TarShapeIncl
- for i=1:length(spos)
- STIM.TrialTypes = [STIM.TrialTypes; pos type spos(i)];
- end
- end
- end
- %% TRIAL ORDER LIST ================
- % Predefine a long list of trial-definitions
- nTrialsDefined = 50000;
- STIM.TrialList=zeros(nTrialsDefined,3);
- %This procedure is less well commented & complex but it results in a list of trials
- for i=1:nTrialsDefined
- if length(STIM.TarShapeIncl)>1 % multiple shapes
- NextTrial=false;
- while ~NextTrial
- % pick a random trialtype number
- TypeNo = ceil(rand(1)*size(STIM.TrialTypes,1));
- % check against demands
- if i==1 && STIM.TarShapeSetup(1) % first target shape matters
- if STIM.TrialTypes(TypeNo,2)==STIM.TarShapeSetup(1)
- % ok
- STIM.TrialList(i,1)=TypeNo;
- STIM.TrialList(i,2)=ceil(2*rand(1));
- LastShape = STIM.TrialTypes(TypeNo,2);
- LastCS = STIM.TrialList(i,2);
- NextTrial=true;
- nConsec = 1;
- end
- elseif i==1 && ~STIM.TarShapeSetup(1)
- STIM.TrialList(i,1)=TypeNo;
- STIM.TrialList(i,2)=ceil(2*rand(1));
- NextTrial=true;
- LastShape = STIM.TrialTypes(TypeNo,2);
- LastCS = STIM.TrialList(i,2);
- nConsec = 1;
-
- elseif i~=1
- if nConsec < STIM.TarShapeSetup(2) && STIM.TarShapeSetup(2)
- % more same-shaped targets
- if STIM.TrialTypes(TypeNo,2)==LastShape
- STIM.TrialList(i,1)=TypeNo;
- if rand(1) <= STIM.ChanceSwitchColScheme
- % switch colors
- if LastCS == 1
- STIM.TrialList(i,2) = 2;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 1;
- end
- else
- % don't switch
- if LastCS == 1
- STIM.TrialList(i,2) = 1;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 2;
- end
- end
- LastCS = STIM.TrialList(i,2);
- NextTrial=true;
- LastShape = STIM.TrialTypes(TypeNo,2);
- nConsec = nConsec+1;
- end
- elseif nConsec == STIM.TarShapeSetup(2)
- if STIM.TrialTypes(TypeNo,2)~=LastShape
- STIM.TrialList(i,1)=TypeNo;
- if rand(1) <= STIM.ChanceSwitchColScheme
- % switch colors
- if LastCS == 1
- STIM.TrialList(i,2) = 2;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 1;
- end
- else
- % don't switch
- if LastCS == 1
- STIM.TrialList(i,2) = 1;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 2;
- end
- end
- LastCS = STIM.TrialList(i,2);
- NextTrial=true;
- LastShape = STIM.TrialTypes(TypeNo,2);
- nConsec = 1;
- end
- elseif ~STIM.TarShapeSetup(2)
- % random
- STIM.TrialList(i,1)=TypeNo;
- if rand(1) <= STIM.ChanceSwitchColScheme
- % switch colors
- if LastCS == 1
- STIM.TrialList(i,2) = 2;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 1;
- end
- else
- % don't switch
- if LastCS == 1
- STIM.TrialList(i,2) = 1;
- elseif LastCS == 2
- STIM.TrialList(i,2) = 2;
- end
- end
- LastCS = STIM.TrialList(i,2);
- NextTrial=true;
- LastShape = STIM.TrialTypes(TypeNo,2);
- end
- end
- end
- else
- % pick a random trialtype number
- TypeNo = ceil(rand(1)*size(STIM.TrialTypes,1));
- STIM.TrialList(i)=TypeNo;
- end
- end
- %random reward assignment
- rewlist=ceil(rand(nTrialsDefined,1)*2);
- RewListDone=false;
- while ~RewListDone
- % check blocks of consecutive same
- rl=rewlist;
- for i=1:STIM.ConsSameRew-1
- rl=diff(rl);
- end
- ii=find(rl==0);
- if ~isempty(ii)
- rewlist(ii+round(STIM.ConsSameRew/2))=...
- rewlist(ii+round(STIM.ConsSameRew/2))+1;
- rewlist(rewlist==3)=1;
- else
- RewListDone=true;
- end
- end
- STIM.TrialList(:,3) = rewlist;
|