Return to the Posner Cueing Task page
___________________________________________________________________________________________________________________	

										Posner Cueing Task
___________________________________________________________________________________________________________________

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 06-07-2018
last updated:  03-13-2020 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 03-13-2020 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________
This script implements a basic Posner Cueing task, a measure of attention, as described at:
https://en.wikipedia.org/wiki/Posner_cueing_task.

___________________________________________________________________________________________________________________
TASK DESCRIPTION	
___________________________________________________________________________________________________________________
Participants are asked to press the spacebar as fast as possible once a star appears in either
a left or a right box that are positioned next to a center fixation cross.

Before each star appears, a cue is given that predicts the location of the star in 
80% of the trials:
endogenous cues (peripheral): the box location of the star is briefly highlighted
exogenous cue (center): an arrow appears above the fixation cross that points to the location of the star.

___________________________________________________________________________________________________________________	
DURATION 
___________________________________________________________________________________________________________________	
the default set-up of the script takes appr. 15 minutes to complete

___________________________________________________________________________________________________________________	
DATA FILE INFORMATION 
___________________________________________________________________________________________________________________	
The default data stored in the data files are:

(1) Raw data file: 'cueingtask_raw*.iqdat' (a separate file for each participant)*

build:								The specific Inquisit version used (the 'build') that was run
computer.platform:					the platform the script was run on (win/mac/ios/android)
date, time, 						date and time script was run 
subject, group, 					with the current subject/groupnumber
script.sessionid:					with the current session id

blockcode, blocknum:				the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum: 				the name and number of the currently recorded trial (built-in Inquisit variable)
										Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
										that do not store data to the data file.
										
phase:								"practice" vs. "test"	
trialtype:							"original" vs. "makeup"	(= repeats)
							
validtrial:							trials that present targets: 1 = spacebar press occurred after onset of target; 0 = otherwise (= early responses + no responses)
									control trials (optional, no targets presented): 1 = no responses; 0 = spacebar press
										Note: if parameters.runMakeupTrials == true => invalid target trials get repeated 
										at the end of their respective blocks (control trials, if run, are excluded from repeats)
								
testtrialcount_targets:				counts valid test trials that present targets (= valid/invalid cue trials) across all test blocks

testtrialcount_controls:			counts valid test control trials that do not present targets across all test blocks 
									(control trials are optional, see parameters.runControlTrials)
										
testtrialcount Total:				counts all valid test trials (valid cues, invalid cues, control trials) across all test blocks

cuevalidity:						0 = control trial (no target presented)
									1 = cue is valid (target appears in cued location); 
									2 = cue is invalid (target appears in opposite location)
								
cuetype:							1 = arrow (endogenous cue); 
									2 = highlighted location box (exogenous cue)

cuelocation:						1 = cue points to left box; 
									2 = cue points to right box

SOA:								the current Stimulus Onset Asynchrony in ms (time btw. cue onset and target onset)

trialTimestamp :					the script elapsed time (in ms) of trial onset (relative to start of script)
latency:							the time (in ms) that spacebar press was recorded; measured from start of trial

RT_Timestamp:						the script elapsed time (in ms) of the onset of the current response (relative to start of script)
									Example: 1389ms => the response (or lack thereof) was recorded 1389ms after onset of script	
									
lastTargetOnset:					the script elapsed time (in ms) of the last target timestamp (relative to start of script)
									Example: 1250ms => the last target was recorded 1250ms after onset of script
								
								
response:							scancode of response button pressed (57 = spacebar; 0 = no response)								
								
																		
RT_stimonset:						Response Time (in ms) to target onset: the difference in ms btw. RT_timestamp and lastTargetOnset
									Example: RT_timestamp - lastTargetOnset = 1389ms - 1250ms = 139ms
									"No Response" => no spacebar press was detected during the trial
									"Early Response" => spacebar press was detected BEFORE the onset of the scheduled target
										Note: if parameters.runMakeupTrials == true 
										=> all 'No Response' and 'Early Response' trials are repeated (applies to valid and invalid cue trials only)

countEarlyResponses_targets:		counts the number of early responses in valid/invalid target trials (test trials only)
									=> early response: a spacebar press that occurs before the target appears
										
countNoResponses_targets:			counts the number of no responses to valid/invalid targets (test trials)
countResponses_controls:			counts the number of spacebar presses in 'control' trials (if control trials are run)									
							
									
(2) Summary data file: 'cueingtask_summary*.iqdat' (a separate file for each participant)*

computer.platform:					the platform the script was run on (win/mac/ios/android)
script.startdate:					date script was run
script.starttime:					time script was started
script.subjectid:					assigned subject id number
script.groupid:						assigned group id number
script.sessionid:					assigned session id number
script.elapsedtime:					time it took to run script (in ms); measured from onset to offset of script
script.completed:					0 = script was not completed (prematurely aborted); 
									1 = script was completed (all conditions run)
								
parameters.runMixedDesign:			true(1) = arrow cue trials and highlight cue trials are run in the same block (order of trials is determined randomly)
									false(0), DEFAULT = arrow cue trials and highlight cue trials are run in a blocked design (order is determined randomly)
							
parameters.runControlTrials:		true(1) = control trials (= no target is presented) are run intermixed with target trials
									false(0), DEFAULT = no control trials are run
							
parameters.runMakeupTrials: 		true(1), DEFAULT = all error trials (valid and invalid cue trials) are repeated 
									at the end of the block (if control trials are run, these are not repeated in case of erroneous responses)
									false(0) = no error trials are repeated

testtrialcount_targets:				counts valid test trials that present targets (= valid/invalid cue trials) across all test blocks

testtrialcount_controls:			counts valid test control trials that do not present targets across all test blocks 
									(control trials are optional, see parameters.runControlTrials)
										
testtrialcount_total:				counts all valid test trials (valid cues, invalid cues, control trials) across all test blocks


countEarlyResponses_targets:		counts the number of early responses in valid/invalid target trials (test trials only)
									=> early response: a spacebar press that occurs before the target appears
								
countNoResponses_targets:			counts the number of no responses to valid/invalid targets (test trials)
countResponses_controls:			counts the number of spacebar presses in 'control' trials (if control trials are run)	

meanRT_validcue_arrow:				mean reaction time (spacebar press) in ms in trials that presented a valid arrow cue (across SOAs)
meanRT_invalidcue_arrow:			mean reaction time (spacebar press) in ms in trials that presented an invalid arrow cue  (across SOAs)
meanRT_validcue_highlight:			mean reaction time (spacebar press) in ms in trials that presented a valid highlighted box cue  (across SOAs)
meanRT_invalidcue_highlight:		mean reaction time (spacebar press) in ms in trials that presented an invalid highlighted box cue  (across SOAs)

* separate data files: to change to one data file for all participants (on Inquisit Lab only), go to section
"DATA" and follow further instructions


___________________________________________________________________________________________________________________	
EXPERIMENTAL SET-UP 
___________________________________________________________________________________________________________________	

Default Set-up of this script:
This script runs one test block of endogenous cues (highlighted box locations, peripheral cues) and one test block of exogenous cues 
(arrow cues above the fixation cross, center cues). The order of the two test blocks is randomly determined.
Each test block runs 100 trials. The default ratio of valid cues: invalid cues = 4 : 1 (=> 80 valid cue trials; 20 invalid cue trials).
Half the trials signal a left target location; half the trials signal a right target location.
The order of the trials is randomly determined for each participant.

Each test block starts with a practice block of 10 trials (default ratio of valid : invalid cues = 4 : 1).

Default Trial Sequence:
- Fixation Cross + 2 empty boxes (for 1000ms, default, can be edited under section Editable Parameters: parameters.cueDelay)
- cue (for 20ms; default can be edited under section Editable Parameters: parameters.cueDuration)
- Stimulus Onset Asynchrony between onset of cue and onset of target of 100ms and 500ms are used (controlled by list.SOAs under section Editable Lists)
by default SOAs are randomly determined without replacement for valid cues, invalid cues (and optional control trials)
=> in the default setting, half of each trial type runs with 100ms SOAs the other half with 500ms SOAs
- target duration (= response timeout) for 1000ms (default, can be edited under section Editable Parameters: parameters.targetDuration)
- Intertrial interval for 1500ms (default, can be edited under section Editable Parameters: parameters.ITI)

Note: by default, 'no responses' on valid and invalid cue trials as well as 'early responses' (spacebar presses that 
are made BEFORE the star appears) are REPEATED with the same settings at the end of each block.


Optional Design Changes:
(1) Instead of running a blocked design of exogenous and endogenous cues, a mixed design can be run.
To run a mixed design, go to section Editable Parameters: parameters.runMixedDesign

A mixed design runs one block of 200 trials (valid cues : invalid cues = 4 : 1).
The practice session runs twice the number of practice trials.

(2) In addition to valid and invalid cue trials, control trials ('catch trials'; trials that do not present a target) can be added.
To add control trials, go to section Editable Parameters: parameters.runControlTrials

The ratio of valid cues : invalid cues : control trials = 4 : 1 : 1

(3) By default, 'no responses' on valid and invalid cue trials as well as 'early responses' (spacebar presses that 
are made BEFORE the star appears) are REPEATED at the end of each block. To turn off the automatic make-up trials,
go to section Editable Parameters: parameters.runMakeUpTrials

___________________________________________________________________________________________________________________	
STIMULI
___________________________________________________________________________________________________________________
provided by Millisecond Software - can be edited under section Editable Stimuli
The size of the boxes and their location on the screen can be edited under section
Editable Parameters.

The default background of the screen is black. Fixation cross and star are presented in white.
Unlit boxes are presented with a gray frame. 'Lit' boxes are presented white.

___________________________________________________________________________________________________________________	
INSTRUCTIONS 
___________________________________________________________________________________________________________________
provided by Millisecond Software - can be edited under section Editable Instructions

___________________________________________________________________________________________________________________	
EDITABLE CODE 
___________________________________________________________________________________________________________________	
check below for (relatively) easily editable parameters, stimuli, instructions etc. 
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code 
to further customize your experiment.

The parameters you can change are:

Design Parameters:

/runMixedDesign:		true(1)
						false(0), default = arrow cue trials and highlight cue trials are run in a blocked design (order is determined randomly)
							
/runControlTrials:		true(1) = control trials (= no target is presented) are run intermixed with target trials
						false(0), default = no control trials are run
							
/runMakeupTrials: 		true(1), default = all error trials (valid and invalid cue trials) are repeated 
						at the end of the block (if control trials are run, these are not repeated in case of erroneous responses)
						false(0) = no error trials are repeated


User Interface Parameters:

/squareheight:				the height of the square in %screenheight (default: 20%)
/fixationheight:			the height of the fixationheight in %screenheight (default: 10%)

/leftsquare_x:				x-coordinate of left square (default: 25%)
							Note: 0% is left side of active canvas - 100% is right side of active canvas
							(active canvas is the part of the screen that is used for the script)
							
/rightsquare_x:				x-coordinate of the right square (default: 75%)
/arrowSize:					proportional height of the arrow (default: 10%)


Timing Parameters:

/cueDelay:					delay of cue (in ms) (default: 1000ms)
/cueDuration:				duration of cue (in ms) (default: 20ms)
/targetduration:			duration of target (in ms) (default: 1000ms) - corresponds to response timeout
/ITI:						intertrial interval (in ms) (default: 1500ms)
/readyDuration:				the duration (in ms) that participants are 'forced' to stay on the 'get ready' page (default: 2000ms)