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

Updated Palamedes parameters

parent 5ad83a85
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%% enter subject ID %% %% enter subject ID %%
%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%
subj = 'TEST_v1'; subj = 'JQK_170707_v2';
%% add required paths %% add required paths
......
% Pipeline including task practice/threshold estimation, MAT pre, checkerboard and MAT post assessment
%%%%%%%%%%%%%%%%%%%%%%
%% enter subject ID %%
%%%%%%%%%%%%%%%%%%%%%%
subj = 'JQK_170707_v2';
%% add required paths
pn.root = '/Volumes/LNDG-1/Julian/Projects/DYNSAT/C_Paradigm/';
pn.CB = [pn.root, 'checker/'];
pn.MAT = [pn.root, 'dotsx/'];
addpath(genpath([pn.root, 'functions/']));
addpath(pn.CB);
addpath(pn.MAT);
addpath(genpath('/Users/Shared/Psychtoolbox/')); % PTB 3.0.13 (160606)
%% create results directory
subjectsPath = [pn.root, '/data/', subj '_' datestr(now, 'yymmdd_HHMM') '/']; mkdir(subjectsPath);
%% set up PTB
Screen('Preference', 'SkipSyncTests', 1);
oldLevel = Screen('Preference', 'Verbosity', 4); % output debugging info
PsychDebugWindowConfiguration(0,0.3)
%% practice MAT task
cd(pn.root);
% staircase parameters
P.PM.numtrials = 60; % (numtrials/2) needs to be round
P.PM.PF = @PAL_Gumbel; % assumed psychometric function
P.PM.grain = 201; % tradeoff between precision & computation time
P.PM.stimRange = .5:.02:.7; % only allow values in range from 50 to 80%
P.PM.priorAlphaRange = linspace(.5,.7,P.PM.grain);
P.PM.priorBetaRange = -1:.05:3;
P.PM.priorGammaRange = 0.5; % fixed chance level
P.PM.priorLambdaRange = .05; % fixed lapse rate
dotInfo = [];
dotInfo = createDotInfo_JQK_170704;
dotInfo.dataDir = subjectsPath;
DEBUG = 1; opacity = 1;
cursubj = [subj, '_MAT_Practice'];
thresholds = MAT_practice_170707(dotInfo, cursubj, DEBUG, opacity, P);
disp(thresholds); disp('Please check whether they are reasonable.')
%% run MAT Task (Pre-CB)
dotInfo = createDotInfo_JQK_170704(thresholds);
dotInfo.dataDir = [pn.root, 'data/'];
cursubj = [subj, '_MAT_Pre'];
DEBUG = 1; opacity = 1;
MAT_experiment_170704(dotInfo, cursubj, DEBUG, opacity)
%% practice checkerboard task
setup.subj = subj;
setup.design = 1;
setup.ET = 0;
setup.in_scanner = 0;
setup.dummyScans = 0;
setup.add_display = 0; % if not in scanner: additional display connected?
setup.test_trigger = 0; % test scanner trigger (1) or not (0)
setup.DEBUG = 1; % debug mode?
setup.transparency = .99; % only relevant if DEBUG == 1
setup.verbosity = 4; % magnitude of PTB output
setup.EPI = 0;
setup.BGmode = 'black'; % black/grey mode
setup.mode = 'task';
[checkerInfo_practice, setup] = PureCheckerParameters_Practice_170403(setup);
setup.catchPractice = 0;
setup.subjectsPath = subjectsPath;
checkerBoard_Practice_Threshold_170705(checkerInfo_practice, setup);
%% set up and run checkerboard
setup = [];
setup.subj = subj;
setup.design = 1;
setup.ET = 0;
setup.in_scanner = 0;
setup.dummyScans = 0;
setup.add_display = 0; % if not in scanner: additional display connected?
setup.test_trigger = 0; % test scanner trigger (1) or not (0)
setup.DEBUG = 1; % debug mode?
setup.transparency = .99; % only relevant if DEBUG == 1
setup.verbosity = 4; % magnitude of PTB output
setup.EPI = 0;
setup.BGmode = 'black'; % black/grey mode
setup.mode = 'task';
[checkerInfo, setup] = PureCheckerParameters_170403(setup);
setup.outputName = 'Task';
setup.subjectsPath = subjectsPath;
checkerContrastComp_170706(checkerInfo, setup)
%% run MAT Task (post-CB)
dotInfo = [];
dotInfo = createDotInfo_JQK_170704(thresholds);
dotInfo.dataDir = subjectsPath;
cursubj = [subj, '_MAT_Post'];
DEBUG = 1; opacity = 1;
MAT_experiment_170704(dotInfo, cursubj, DEBUG, opacity)
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
% adapted from dotsExperiment_JQK_170327 % adapted from dotsExperiment_JQK_170327
% 170704 | cleanup, adapted % 170704 | cleanup, adapted
% 170707 | removed saving for each trial; instead save in catch part
% | now saves DisplayInfo
function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity) function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity)
...@@ -125,13 +127,12 @@ function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity) ...@@ -125,13 +127,12 @@ function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity)
Screen('Flip', screenInfo.curWindow); Screen('Flip', screenInfo.curWindow);
end end
end end
save(sessionFile, 'ExperimentProtocol', 'dotInfo','ResultMat'); end % trial presentation
end % block
sessEndTime = GetSecs; sessEndTime = GetSecs;
ExperimentProtocol = [ExperimentProtocol; {'SessionEnd'}, {sessEndTime}, {[]}, {[]}, {[]}, {indTrial}, {[]}]; ExperimentProtocol = [ExperimentProtocol; {'SessionEnd'}, {sessEndTime}, {[]}, {[]}, {[]}, {indTrial}, {[]}];
save(sessionFile, 'ExperimentProtocol', 'dotInfo', 'ResultMat'); save(sessionFile, 'ExperimentProtocol', 'dotInfo', 'ResultMat', 'DisplayInfo');
% inform the subject that the experiment is over % inform the subject that the experiment is over
DrawFormattedText(screenInfo.curWindow, 'task complete!', 'center', 'center'); DrawFormattedText(screenInfo.curWindow, 'task complete!', 'center', 'center');
...@@ -159,6 +160,7 @@ function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity) ...@@ -159,6 +160,7 @@ function MAT_experiment_170704(dotInfo, subj, DEBUG, opacity)
catch exception catch exception
getReport(exception) % show stack trace getReport(exception) % show stack trace
save(sessionFile);
end end
closeExperiment; % close drawing canvas closeExperiment; % close drawing canvas
......
...@@ -349,10 +349,14 @@ function [thresholds] = MAT_practice_170704(dotInfo, subj, DEBUG, opacity, P) ...@@ -349,10 +349,14 @@ function [thresholds] = MAT_practice_170704(dotInfo, subj, DEBUG, opacity, P)
%% 4th dimension %% 4th dimension
% intialize psi parameters % intialize psi parameters
PM = PAL_AMPM_setupPM('priorAlphaRange' , P.PM.priorAlphaRange, ... PM = PAL_AMPM_setupPM(...
'stimRange', P.PM.stimRange, 'numtrials', P.PM.numtrials, ... 'priorAlphaRange' , P.PM.priorAlphaRange, ...
'gamma', P.PM.gamma, 'priorLambdaRange', P.PM.priorLambdaRange, ... 'stimRange', P.PM.stimRange, ...
'marginalize', 'slope', 'marginalize', 'lambda'); 'numtrials', P.PM.numtrials, ...
'gamma', P.PM.gamma, ...
'priorLambdaRange', P.PM.priorLambdaRange, ...
'marginalize', 'slope', ...
'marginalize', 'lambda');
% intiate parameters % intiate parameters
indTrial = 1; indTrial = 1;
......
This diff is collapsed.
...@@ -81,6 +81,8 @@ debug.Timing = 1; ...@@ -81,6 +81,8 @@ debug.Timing = 1;
% 170704 JQK: - added confidence ratings; cntrl+alt as answer % 170704 JQK: - added confidence ratings; cntrl+alt as answer
% alternatives; cleanup % alternatives; cleanup
% 170707 JQK: - added confidence onset timing
% - take into consideration ifi in presentation loop
if nargin < 3 if nargin < 3
targets = []; targets = [];
...@@ -253,7 +255,7 @@ ExperimentProtocol = [ExperimentProtocol; {'TrialOnset'}, {StartTime}, {[]}, {[] ...@@ -253,7 +255,7 @@ ExperimentProtocol = [ExperimentProtocol; {'TrialOnset'}, {StartTime}, {[]}, {[]
% initiate response cue % initiate response cue
KbQueueCreate; KbQueueStart; KbQueueCreate; KbQueueStart;
while GetSecs()-StartTime < dotInfo.durPres % loop while presentation time has not been reached while GetSecs()-StartTime < dotInfo.durPres-ifi % loop while presentation time has not been reached
% On each update, the assignments of the attributes to pixels changes. % On each update, the assignments of the attributes to pixels changes.
...@@ -564,6 +566,7 @@ if dotInfo.durConf ~= 0 ...@@ -564,6 +566,7 @@ if dotInfo.durConf ~= 0
Screen('DrawTexture', screenInfo.curWindow, cue2Disp, [], smallIm); % draw the object Screen('DrawTexture', screenInfo.curWindow, cue2Disp, [], smallIm); % draw the object
ConfOnset = Screen('Flip', curWindow,0,dontclear); ConfOnset = Screen('Flip', curWindow,0,dontclear);
ExperimentProtocol = [ExperimentProtocol; {'ConfOnset'}, {ConfOnset}, {[]}, {[]}, {[]}, {indTrial}, {[]}];
kp = NaN; rt_conf = NaN; conf = NaN;curSelConf = NaN; kp = NaN; rt_conf = NaN; conf = NaN;curSelConf = NaN;
while GetSecs()-ConfOnset < dotInfo.durConf % wait until cuetime is over while GetSecs()-ConfOnset < dotInfo.durConf % wait until cuetime is over
......
% Note: This dataset does not contain an encoding of confidence onset.
Pre = load('/Volumes/LNDG-1/Julian/Projects/DYNSAT/C_Paradigm/data/JQK_170705_v1/dotsX_behav_JQK_170705_v1_PreMAT_170705_1817.mat');
Post = load('/Volumes/LNDG-1/Julian/Projects/DYNSAT/C_Paradigm/data/JQK_170705_v1/dotsX_behav_JQK_170705_v1_PostMAT_170705_1907.mat');
Pre.ExperimentProtocol
% get elapsed time between trial onsets & stimulus presentation duration (i.e. probe onset-first flip)
IndexOnsetPre = find(contains(Pre.ExperimentProtocol(:,1),'TrialOnset')); % R2016b
IndexOnsetPost = find(contains(Post.ExperimentProtocol(:,1),'TrialOnset')); % R2016b
IndexProbePre = find(contains(Pre.ExperimentProtocol(:,1),'RespOnset')); % R2016b
IndexProbePost = find(contains(Post.ExperimentProtocol(:,1),'RespOnset')); % R2016b
figure;
subplot(2,2,1);
plot(diff(cell2mat(Pre.ExperimentProtocol(IndexOnsetPre,2)))); xlim([0 numel(Index)])
title('Pre: TrialDuration'); ylabel('Duration [s]')
subplot(2,2,2);
plot(diff(cell2mat(Post.ExperimentProtocol(IndexOnsetPost,2)))); xlim([0 numel(Index)])
title('Post: TrialDuration'); ylabel('Duration [s]')
subplot(2,2,3);
plot((cell2mat(Pre.ExperimentProtocol(IndexProbePre,2))-cell2mat(Pre.ExperimentProtocol(IndexOnsetPre+1,2))).*1000); xlim([0 numel(Index)])
title('Pre: stim duration'); ylabel('Duration [ms]')
subplot(2,2,4);
plot((cell2mat(Post.ExperimentProtocol(IndexProbePost,2))-cell2mat(Post.ExperimentProtocol(IndexOnsetPost+1,2))).*1000); xlim([0 numel(Index)])
title('Post: stim duration'); ylabel('Duration [ms]')
% get amount of flips per presentation duration (i.e. flicker rate)
updateAmount = (IndexProbePost-IndexOnsetPost-1);
presentationDuration = (cell2mat(Post.ExperimentProtocol(IndexProbePost,2))-cell2mat(Post.ExperimentProtocol(IndexOnsetPost+1,2)));
figure;
plot(updateAmount./presentationDuration); xlim([0 numel(Index)]);
title('MAT Update Rate'); ylabel('Presentation Frequency [Hz]'); xlabel('Trial')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment