+x+xHello all,
We recently acquired a Cedrus RB-740 for use with the Perceptual Vigilance Task (
https://www.millisecond.com/download/library/perceptualvigilancetask/). The (main) problem is that the test is really set up for either a mouse or touchscreen - hence the first "click/tap here to begin" button that appears at the very beginning.
I've tried putting in "inputdevice = XID" where appropriate, but no button presses on the response pad will advance the intro screen to the actual test. The computer seems to recognize the device as a Lumina keyboard, so we don't think it's necessarily a hardware issue (for now).
Is there a way to get the test to recognize the response pad? Would it be better for us to use the Psychomotor Vigilance Task (
https://www.millisecond.com/download/library/psychomotorvigilancetest/) instead? Will/should all of the buttons allow input, or can/should we allow input on only one button?
We are aiming to use the response pad with the N-back as well, so hopefully the same fix will apply.
Thanks in advance!
To adapt the script for response pad input, you'll have to change the /inputdevice settings AND modify the /validresponse in <trial start> and <trial USRT> accordingly. Your response pad will send some numerical code upon button a specific button press. The first thing is to figure out the numerical codes for the keys you wish to use. You should be able to run the "Cedrus Lumina and RB Series Response Devices" script available at
https://www.millisecond.com/download/library/cedrus/ to figure those codes out (make sure the pad is set to XID-mode;
https://www.millisecond.com/support/docs/v5/html/howto/cedrusresponse.htm ).
Alternatively, set up a simple script that just does something like
<block example>
/ trials = [1-5 = exampletrial]
</block>
<trial exampletrial>
/ pretrialpause = 500
/ posttrialpause = 500
/ stimulusframes = [1=exampletext]
/ inputdevice = XID
/ validresponse = (anyresponse)
</trial>
<text exampletext>
/ items = ("Press the button on the response pad")
</text>
The "response" column in the resulting data file should hold the numerical code of interest.
Once you have that code, setting <trial start> and <trial USRT> to something like
<trial start>
/stimulusframes = [1 = targetcircle]
/ isvalidresponse = [trial.start.response == TheNumericalCode]/ recorddata = false
</trial>
and
<trial USRT>
/ontrialbegin = [
values.trialStart = script.elapsedtime;
values.EarlyResponse = 0;
values.rt = "too early";
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};
values.lastCircleTimestamp = shape.targetcircle.timestamp;
values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == TheNumericalCode]/ isvalidresponse = [
values.rt_elapsed = script.elapsedtime;
1==1;
]
/ontrialend = [
if (shape.targetcircle.timestamp <= values.lastCircleTimestamp){
values.EarlyResponse = 1;
values.countEarlyResponses += 1;
values.countResponses += 1;
} else {
values.rt = values.rt_elapsed - shape.targetcircle.timestamp;
list.latencies.appenditem(values.rt);
values.countResponses += 1;
};
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>
where
TheNumericalCode is the value for the respective key on your response pad (e.g. 12).
Hi Dave,
Thank you very much for your helpful response! As suggested I downloaded the response device script, no issues there - all the buttons seemed to be registering and I was able to see the button presses / response times and whatnot. However, after adjusting the code to how you have it, I still cannot get past the initial screen to move on to the actual PVT test. Any suggestions? I've copy and pasted the code I'm using below.
**************************************************************************************************************
**************************************************************************************************************
EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************
<parameters>
/targetcolor = red
/targetsize = 5%
/targetx = 50%
/targety = 50%
/screencolor = white
/feedbackheight = 5%
/fixed = 1
/testduration = 600000
/presenttrialfeedback = false
/rtfeedback_duration = 500
</parameters>
**************************************************************************************************************
**************************************************************************************************************
EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ inputdevice = XID
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>
Note:
Change instructions to suit your experiment
<page instruct>
^^^In this exercise you will see a circle flash on the screen at random times.
^^^Your task is to press the button as soon as possible once you see the circle.
^^^The exercise will take <%parameters.testduration/1000/60%> minutes to complete.
^^^Whenever you're ready, press the button on the "Continue" button below to start.
</page>
<page feedback>
Exercise complete!
^^
^^Your average/mean response time was: <%expressions.meanRT%> ms
^^Your fastest response time was: <%expressions.minRT%> ms
^^Your slowest response time was : <%expressions.maxRT%> ms
</page>
****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/buttoninstruct1 = {"click your mouse button";}
</expressions>
**************************************************************************************************************
**************************************************************************************************************
EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************
Note:
List.stimulusinterval randomly selects with replacement the amount of time that the focus stimulus will be shown before
presenting the target. (suggested intervals: 1s-10s)
<list stimulusinterval>
/ items = (1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
/ replace = true
/ selectionrate = trial
</list>
**************************************************************************************************************
!!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************
**************************************************************************************************************
**************************************************************************************************************
DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher
<defaults>
/canvasaspectratio = (4,3)
/minimumversion = "5.0.0.0"
/inputdevice = XID
/validresponse = (anyresponse)
/ fontstyle = ("Arial", 3.5%)
/ screencolor = white
/ txbgcolor = black
/ txcolor = white
</defaults>
*******************************************************************************************************************
*******************************************************************************************************************
DATA: this section contains data file information
*******************************************************************************************************************
*******************************************************************************************************************
*************************
raw data
*************************
<data>
/ columns = (build, computer.platform, time, subject, blockcode, trialcode, trialnum, parameters.testduration,
parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
values.stiminterval, response, values.rt)
/ separatefiles = true
</data>
***********************
Summary Data
***********************
<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
parameters.testduration, parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
expressions.meanRT, expressions.Std, expressions.medianRT, expressions.minRT, expressions.maxRT)
/ separatefiles = true
</summarydata>
*******************************************************************************************************************
*******************************************************************************************************************
VALUES: automatically updated
*******************************************************************************************************************
*******************************************************************************************************************
/completed:0 = script was not completed; 1 = script was completed (all conditions run)
/stiminterval:determines how long the focus stimulus is shown before the target stimulus is presented
/rt:stores the current response latency
<values>
/completed = 0
/stiminterval = 0
/rt = 0
</values>
*******************************************************************************************************************
*******************************************************************************************************************
EXPRESSIONS
*******************************************************************************************************************
*******************************************************************************************************************
/meanRT:calculates the mean response latency (for trials that were responded to)
/StD:calculates the standard deviation of the response latencies (for trials that were responded to)
/medianRT:calculates the median latency (for trials that were responded to)
/minrt:stores the minimum response latency
/maxrt:stores the maximum response latency
Note: list.latencies is used to retrieve all descriptive statistics
<expressions>
/meanRT = list.latencies.mean
/medianRT = list.latencies.median
/Std = list.latencies.standarddeviation
/minRT = list.latencies.minimum
/maxRT = list.latencies.maximum
</expressions>
*******************************************************************************************************************
*******************************************************************************************************************
STIMULI
*******************************************************************************************************************
*******************************************************************************************************************
<shape targetcircle>
/ shape = circle
/ position = (parameters.targetx, parameters.targety)
/ color = red
/ size = (parameters.targetsize*0.75, parameters.targetsize)
</shape>
<text RT_feedback>
/items = ("<%values.rt%>")
/ fontstyle = ("Arial", parameters.feedbackheight, false, false, false, false, 5, 1)
/ txcolor = black
/txbgcolor = white
/ position = (50%, 50%)
</text>
*******************************************************************************************************************
*******************************************************************************************************************
LISTS
*******************************************************************************************************************
*******************************************************************************************************************
Note:
list.targetposition selects randomly an x-coordinate and a y-coordinate, so that the target can appear in 9 different screen locations
<list targetposition>
/items = (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90%, 95%)
/replace = true
/ selectionrate = always
</list>
Data list: stores latencies of all trials that are responded to (fills during runtime).
-> used for descriptive statistics
<list latencies>
</list>
*******************************************************************************************************************
*******************************************************************************************************************
TRIALS
*******************************************************************************************************************
*******************************************************************************************************************
Note: presents the targetcircle and waits for mouse click input to start the test
<trial start>
/stimulusframes = [1 = targetcircle]
/isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>
Note:
Main trial: presents the fixationcross and the stimulus (either in a fixed position or randomly) and waits for mouse click
<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};
values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>
Note: presents latency feedback for parameters.rtfeedback_duration (editable value)
<trial RT_feedback>
/stimulusframes = [1 = RT_feedback]
/trialduration = parameters.rtfeedback_duration
/recorddata = false
/branch = [trial.usrt]
</trial>
*******************************************************************************************************************
*******************************************************************************************************************
BLOCKS
*******************************************************************************************************************
*******************************************************************************************************************
Note: this is the main block provided. It runs a specified amount of time with either a fixed or a
random position for the target.
<block USRTblock>
/ trials = [1 = start; 2 = USRT]
/ onblockbegin = [block.USRTblock.screencolor = parameters.screencolor]
/timeout = parameters.testduration
</block>
*******************************************************************************************************************
*******************************************************************************************************************
EXPERIMENT
*******************************************************************************************************************
*******************************************************************************************************************
Note: Main script, change according to your needs.
<expt>
/ preinstructions = (instruct)
/ postinstructions = (feedback)
/ blocks = [1=USRTblock]
/onexptend = [values.completed = 1]
</expt>
<monkey>
/ latencydistribution = normal(300, 40)
</monkey>
*******************************************************************************************************************
End of File
*******************************************************************************************************************