/usr/share/psychtoolbox-3/Quest/QuestSimulate.m is in psychtoolbox-3-common 3.0.9+svn2579.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | function response=QuestSimulate(q,tTest,tActual,plotIt)
% response=QuestSimulate(q,intensity,tActual [,plotIt])
%
% Simulate the response of an observer with threshold tActual when exposed
% to a stimulus tTest.
%
% 'plotIt' is optional: If set to a non-zero value, the simulated Quest
% session is visualized in a plot which shows the psychometric function of
% the simulated observer, where Quest placed test trials and what the
% observers response was. plotIt == 1 shows past trials in black, the
% current trial in green or red for a positive or negative response. plotIt
% == 2 color-codes all trials in red/green for negative or positive
% responses. By default, nothing is plotted.
%
% See Quest.
% Denis Pelli, 6/8/96
% 3/1/97 dgp restrict intensity parameter to range of x2.
% 3/1/97 dgp updated to use Matlab 5 structs.
% 4/12/99 dgp dropped support for Matlab 4.
% Copyright (c) 1996-2004 Denis Pelli
if nargin < 3
error('Usage: response=QuestSimulate(q,tTest,tActual[,plotIt])')
end
if length(q)>1
error('can''t deal with q being a vector')
end
t=min(max(tTest-tActual,q.x2(1)),q.x2(end));
response=interp1(q.x2,q.p2,t) > rand(1);
% Visualize if requested:
if (nargin >= 4) && (plotIt > 0)
tc = t;
col = {'*r', '*g'};
t = min(max(q.intensity(1:q.trialCount) - tActual, q.x2(1)), q.x2(end));
if plotIt == 2
positive = find(q.response(1:q.trialCount) > 0);
negative = find(q.response(1:q.trialCount) <= 0);
pcol = 'og';
else
positive = 1:q.trialCount;
negative = [];
pcol = 'ok';
end
plot(q.x2 + tActual, q.p2, 'b', ...
t(positive) + tActual, interp1(q.x2,q.p2,t(positive)), pcol, ...
t(negative) + tActual, interp1(q.x2,q.p2,t(negative)), 'or', ...
tActual, interp1(q.x2 + tActual,q.p2,tActual), 'x', ...
tc + tActual, interp1(q.x2,q.p2,tc), col{response + 1});
end
|