Skip to content

Commit

Permalink
HaloEffect instructions
Browse files Browse the repository at this point in the history
* Tweaks to halo effect
* Core extensions to cover edge cases in HaloEffect
  • Loading branch information
mjaquiery committed Feb 15, 2018
1 parent d9f8c15 commit cb010a0
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 50 deletions.
49 changes: 33 additions & 16 deletions HaloEffect/build_trials.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@
trialid = 0;
[block_trials0, block_trials1] =deal([]); %initialize as empty vectors

% practice trials
for b = 1: cfg.practice.block_count
%% introduction
for type = 1:2
if type == 1
tt = cfg.taskType.dots;
else
tt = cfg.taskType.quiz;
end
for t = 1:3
trials = [trials getNewTrial(t*type, 0)];
trials(end).instr = true;
trials(end).practice = true;
if t == 3
trials(end).advisorId = cfg.advisors.count.real+1;
end
end
end

%% practice trials
for b = 1: cfg.practice.block_count+1
block_trials0 = []; %clear vector
for t = 1:cfg.practice.trial_count
trialid = trialid+1;
Expand All @@ -19,17 +36,22 @@
trials = cat(2,trials,block_trials0); % concatenate practice block
end

% experimental trials
%% experimental trials
for b = b+1 : cfg.practice.block_count+cfg.block_count
block_trials1 = [];
for ts = 1 : cfg.block.trialset_count % trialset
for t = 1:cfg.trialset.real+cfg.trialset.null
for a = 1:cfg.advisors.count.real
for t = 1:cfg.trialset.real
trialid = trialid + 1;
block_trials1 = [block_trials1 getNewTrial(trialid, b)];
block_trials1(end).taskType = cfg.block.taskType(b);
block_trials1(end).advisorId = a; % cycle through advisors by block
end
end
for t = 1:cfg.trailset.null
trialid = trialid + 1;
block_trials1 = [block_trials1 getNewTrial(trialid, b)];
block_trials1(end).taskType = cfg.block.taskType(b);
if t > cfg.trialset.real
block_trials1(end).advisorId = getABBA(b); % cycle through advisors by block
end
end
end
block_trials1 = block_trials1(randperm(length(block_trials1))); % randomize trials within a block
Expand Down Expand Up @@ -57,10 +79,11 @@

%% Add extra information at each trial
for t = 1:length(trials)
if trials(t).block == 0
continue
end
%-- add breaks and instruction points
if t == 1
trials(t).instr = true;
elseif trials(t-1).block ~= trials(t).block % first trial in a new block
if trials(t-1).block ~= trials(t).block % first trial in a new block
trials(t).break = true;
trials(t).feedback = true;
if trials(t).block <= cfg.practice.block_count+1 % first trials in practice blocks
Expand All @@ -72,12 +95,6 @@
end
end
end
if isfield(cfg.block, 'advisorPolitics')
% display advisors at appropriate points
if trials(t).block >= cfg.block.advisorPolitics.start && ~mod(t,cfg.block.advisorPolitics.frequency)
trials(t).advisorPolitics = true;
end
end
end

%-- check fields: none should be empty
Expand Down
18 changes: 6 additions & 12 deletions HaloEffect/main.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%% STUDY 3 - agreement in confidence and uncertainty #####################
%% script by Niccolo Pescetelli %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [email protected]
%% outline by Niccolo Pescetelli
%% Extensions by Matt Jaquiery
% [email protected]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -104,7 +103,7 @@
end
%% save and break
if trials(t).break
%% Save dataon break trials
%% Save data on break trials
save([cfg.path.results osSlash subject.dir osSlash subject.fileName '_' num2str(round(t/20))],'trials', 'cfg', 't')
%% break
Screen('TextSize',Sc.window,cfg.instr.textSize.large);
Expand All @@ -118,16 +117,11 @@
instructions(trials(t).block);
end
%% introduce observers
if trials(t).block>1 && trials(t-1).block<5 && trials(t).block ~= trials(t-1).block
if isnan(trials(t).advisorId) % first trial is a null trial
for n = t:cfg.block.trialset_count*(cfg.trialset.real+cfg.trialset.null)
if n>0 && trials(n).block == trials(t).block && ~isnan(trials(n).advisorId)
introduce_observers(trials(n).advisorId);
break;
end
end
if t > 1 && trials(t).block ~= trials(t-1).block
if trials(t).practice
introduce_observers(NaN,1);
else
introduce_observers(trials(t).advisorId);
introduce_observers();
end
end
%% questionnaire
Expand Down
2 changes: 1 addition & 1 deletion HaloEffect/set_cfg_settings.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
% x = ac * (choice*(ac-1 + include_void_choice) + nochoice) + null
% ac = cfg.advisors.count.real
cfg.block_count = 6; % number of blocks
cfg.trialset.real = 60;
cfg.trialset.real = 25; % real trials per observer
cfg.trialset.null = 2; % number of null trials = number of observers x 2
cfg.block.trialset_count = 1; % number of trial sets in each block
cfg.block.questionnaire_frequency = 3; % include questionnaires after each how many blocks?
Expand Down
8 changes: 7 additions & 1 deletion HaloEffect/set_cfg_text.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
% overwrite the estimated accuracy question to specify the dot task:
cfg.instr.estimated_obsacc.text = {'On the dot task, your overall accuracy (before any advice) was 71%' ...
'What do you think this person''s accuracy was on the dot task?' ...
'[help_string]'...
'Enter a number between 0 and 100 and press Enter: '};

% Instruction Intro Images
cfg.intro = {{} {} {} {}};
slideCount = 16;
slideGroups = [8 6 1 1]; % length of the slide groups
x = [cfg.path.base 'instructions' osSlash 'Slide'];
x = [cfg.path.base 'instructions' osSlash 'HaloEffect' osSlash 'Slide'];
j = 0;
for i = 1:slideCount
if j == 0 || i > sum(slideGroups(1:j))
Expand Down
57 changes: 39 additions & 18 deletions core/introduce_observers.m
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
function introduce_observers(advisorId)
function introduce_observers(advisorId, practiceObservers, forceReintroduction)
%% Introduce advisors to the participant
%
% usage: introduce_observers([advisorId])
% usage: introduce_observers([advisorId = NaN[, practiceObservers = 0[, forceReintroduction = 0]]])
%
% Inputs:
% advisorId - ID of the advisor to introduce. If blank, introduce all
% advisors
%
% practiceObservers - whether to introduce practice rather than real
% observers
% forceReintroduction - whether to introduce observers who are already
% introduced
global cfg;
global Sc;

if nargin < 3, forceReintroduction = 0; end
if nargin < 2, practiceObservers = 0; end
if nargin < 1, advisorId = NaN; end

cfg.expositionTime = [];
cfg.expositionTime=[];
observers = randperm(cfg.advisors.count.real);
oldTextSize = Screen('TextSize', Sc.window, cfg.instr.textSize.medium);
bounds = Screen('TextBounds',Sc.window,cfg.instr.intro.text{1});
if isnan(advisorId)
if practiceObservers
observers = cfg.advisors.count.real+1:cfg.advisors.count.all;
else
observers = randperm(cfg.advisors.count.real);
end
for obs = observers
if ~isnan(cfg.advisor(obs).timeIntroduced) && ~forceReintroduction
continue
end
drawAdvisor(obs);
speech = PsychPortAudio('Open', [], [], 0, cfg.introSpeechFreq{cfg.advisor(obs).voice}, cfg.introSpeechChannels{cfg.advisor(obs).voice});
PsychPortAudio('FillBuffer',speech , cfg.introSpeechData{cfg.advisor(obs).voice});
Expand All @@ -33,22 +45,31 @@ function introduce_observers(advisorId)
[resp offset_pic(obs) kcode] = collect_response(inf);
Screen('Flip',Sc.window);
cfg.expositionTime(obs) = offset_pic(obs) - ti;
% remember they were introduced
if isnan(cfg.advisor(obs).timeFirstIntroduced)
cfg.advisor(obs).timeIntroduced = GetSecs();
end
end
else
drawAdvisor(advisorId);
speech = PsychPortAudio('Open', [], [], 0, cfg.introSpeechFreq{cfg.advisor(advisorId).voice}, cfg.introSpeechChannels{cfg.advisor(advisorId).voice});
PsychPortAudio('FillBuffer',speech , cfg.introSpeechData{cfg.advisor(advisorId).voice});
ti=GetSecs;
onset_pic(advisorId) = Screen('Flip',Sc.window,ti);
onset_speech(advisorId) = PsychPortAudio('Start', speech, 1);
[startTime offset_speech(advisorId) xruns ~] = PsychPortAudio('Stop', speech,1);
drawAdvisor(advisorId);
Screen('DrawText', Sc.window, cfg.instr.intro.text{1}, Sc.center(1)-bounds(3)/2, cfg.instr.intro.position.y);
Screen('Flip',Sc.window,ti+2);
PsychPortAudio('Close', speech);
[resp offset_pic(advisorId) kcode] = collect_response(inf);
Screen('Flip',Sc.window);
cfg.expositionTime(advisorId) = offset_pic(advisorId) - ti;
if isnan(cfg.advisor(advisorId).timeIntroduced) || forceReintroduction
drawAdvisor(advisorId);
speech = PsychPortAudio('Open', [], [], 0, cfg.introSpeechFreq{cfg.advisor(advisorId).voice}, cfg.introSpeechChannels{cfg.advisor(advisorId).voice});
PsychPortAudio('FillBuffer',speech , cfg.introSpeechData{cfg.advisor(advisorId).voice});
ti=GetSecs;
onset_pic(advisorId) = Screen('Flip',Sc.window,ti);
onset_speech(advisorId) = PsychPortAudio('Start', speech, 1);
[startTime offset_speech(advisorId) xruns ~] = PsychPortAudio('Stop', speech,1);
drawAdvisor(advisorId);
Screen('DrawText', Sc.window, cfg.instr.intro.text{1}, Sc.center(1)-bounds(3)/2, cfg.instr.intro.position.y);
Screen('Flip',Sc.window,ti+2);
PsychPortAudio('Close', speech);
[resp offset_pic(advisorId) kcode] = collect_response(inf);
Screen('Flip',Sc.window);
cfg.expositionTime(advisorId) = offset_pic(advisorId) - ti;
if isnan(cfg.advisor(advisorId).timeFirstIntroduced)
cfg.advisor(advisorId).timeFirstIntroduced = GetSecs();
end
end
end

cfg.obsIntro_times = [onset_pic; offset_pic; onset_speech; offset_speech];
Expand Down
3 changes: 2 additions & 1 deletion getNewAdvisor.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
advisor.pic = NaN; % portrait id
advisor.voice = NaN; % voice id
advisor.name = 'UNNAMED'; % name
advisor.firstQuestionnaireDone = false; % whether the prospective questionnaire has been answered
advisor.firstQuestionnaireDone = false; % whether the prospective questionnaire has been answered
advisor.timeFirstIntroduced = NaN; % time the advisor was introduced
Binary file added instructions/Instructions_HaloEffect_4x3.pptx
Binary file not shown.
2 changes: 1 addition & 1 deletion launcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
feedbackEnabled = 0;
debugMode = 1;
shortMode = 1;
pathRoot = 'MattWork';
pathRoot = 'MattHome';

%% set path
switch pathRoot
Expand Down
35 changes: 35 additions & 0 deletions stims/generalKnowledgeQuestions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,39 @@
<answer>the Boy Scouts and Girl Guides</answer>
<distractor>the British National Party</distractor>
</question>
<question>
<text>What does a herpetologist study?</text>
<answer>reptiles and amphibians</answer>
<distractor>skin diseases</distractor>
</question>
<question>
<text>Kenneth Graham, a Bank of England bank clerk, wrote the children's classic</text>
<answer>'The Wind in the Willows'</answer>
<distractor>'Swallows and Amazons'</distractor>
</question>
<question>
<text>Honor Blackman starred in the James Bond film</text>
<answer>'Goldfinger'</answer>
<distractor>'Dr. No'</distractor>
</question>
<question>
<text>Thinking they were giants, Don Quixote attacked</text>
<answer>windmills</answer>
<distractor>totem poles</distractor>
</question>
<question>
<text>In cookery, florentine means served with </text>
<answer>spinach</answer>
<distractor>honey</distractor>
</question>
<question>
<text>The ship on which the young Charles Darwin served as naturalist was named</text>
<answer>'The Beagle'</answer>
<distractor>'The Hispaniola'</distractor>
</question>
<question>
<text>The orchestral suite 'The Planets' was composed by</text>
<answer>Gustav Holst</answer>
<distractor>George Frideric Handel</distractor>
</question>
</quiz>

0 comments on commit cb010a0

Please sign in to comment.