Record Response Count


Author
Message
JustinH
JustinH
New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)
Group: Forum Members
Posts: 3, Visits: 21
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
JustinH - 6/2/2023
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Provide runnable example code, please. It's not clear what exactly you are doing and want to do based on the very barebones description you provided.
JustinH
JustinH
New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)
Group: Forum Members
Posts: 3, Visits: 21
Dave - 6/2/2023
JustinH - 6/2/2023
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Provide runnable example code, please. It's not clear what exactly you are doing and want to do based on the very barebones description you provided.

Hi Dave. I've copied some (cutdown) code below. It presents a sequence of jpg images (the full list has been cut here) and periodically a target image, T (a monkey). The subject is required to respond using the spacebar when T appears, but the response only wins points and feedback (not included in the script below) if it is made within a response window. The response window on each trial starts after a randomly variable delay interval ("wait") from the onset of T. This variable delay means that the participant will have to respond repeatedly during T in order to gurantee that they make a response within the response window.
At present, the data file only shows whether a response was made within the respons window, and shows the response latency from the end of the wait interval. However, i would like to also record on each trial how many responses the participant made throughout the whole trial and also record what the random wait time was on that trial.

<picture Monkey>
/ items = monkey_picture
</picture>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<picture fillerpictures>
/ items = fillers
</picture>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ wait = 1000
/ window = 400
</values>

<trial T>
/ ontrialbegin = [values.wait = rand(100,1600)]
/ trialduration = 2000
/ stimulusframes = [1=Monkey]
/ validresponse = (57)
/ correctresponse = (57)
/ beginresponsetime = values.wait
/ isvalidresponse = [if(trial.T.latency<values.window) {values.points +=100}]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
            2-3 = noreplace(TESTblock, BlankBlock);
            4-5 = noreplace(TESTblock, BlankBlock);
            6-7 = noreplace(TESTblock, BlankBlock);
            8-9 = noreplace(TESTblock, BlankBlock);
            10-11 = noreplace(TESTblock, BlankBlock);
            12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
JustinH - 6/3/2023
Dave - 6/2/2023
JustinH - 6/2/2023
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Provide runnable example code, please. It's not clear what exactly you are doing and want to do based on the very barebones description you provided.

Hi Dave. I've copied some (cutdown) code below. It presents a sequence of jpg images (the full list has been cut here) and periodically a target image, T (a monkey). The subject is required to respond using the spacebar when T appears, but the response only wins points and feedback (not included in the script below) if it is made within a response window. The response window on each trial starts after a randomly variable delay interval ("wait") from the onset of T. This variable delay means that the participant will have to respond repeatedly during T in order to gurantee that they make a response within the response window.
At present, the data file only shows whether a response was made within the respons window, and shows the response latency from the end of the wait interval. However, i would like to also record on each trial how many responses the participant made throughout the whole trial and also record what the random wait time was on that trial.

<picture Monkey>
/ items = monkey_picture
</picture>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<picture fillerpictures>
/ items = fillers
</picture>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ wait = 1000
/ window = 400
</values>

<trial T>
/ ontrialbegin = [values.wait = rand(100,1600)]
/ trialduration = 2000
/ stimulusframes = [1=Monkey]
/ validresponse = (57)
/ correctresponse = (57)
/ beginresponsetime = values.wait
/ isvalidresponse = [if(trial.T.latency<values.window) {values.points +=100}]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
            2-3 = noreplace(TESTblock, BlankBlock);
            4-5 = noreplace(TESTblock, BlankBlock);
            6-7 = noreplace(TESTblock, BlankBlock);
            8-9 = noreplace(TESTblock, BlankBlock);
            10-11 = noreplace(TESTblock, BlankBlock);
            12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>



If you use /beginresponsetime, then you cannot capture responses during the wait time, so the whole approach here is not suitable for what you want to do and you need to rethink it.

No responses are registered in the period before the specified beginresponsetime, that's the enitre point of beginresponstime. So, in order to begin capturing responses during the entire trial, including the wait period, you necessarily ought to set beginresponsetime to 0.

As for counting the number of space bar presses, see e.g. https://forums.millisecond.com/Topic22895.aspx#22899

As for logging any values, define a data element, specify its /columns and include values.wait, values.window, etc. there.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - 6/3/2023
JustinH - 6/3/2023
Dave - 6/2/2023
JustinH - 6/2/2023
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Provide runnable example code, please. It's not clear what exactly you are doing and want to do based on the very barebones description you provided.

Hi Dave. I've copied some (cutdown) code below. It presents a sequence of jpg images (the full list has been cut here) and periodically a target image, T (a monkey). The subject is required to respond using the spacebar when T appears, but the response only wins points and feedback (not included in the script below) if it is made within a response window. The response window on each trial starts after a randomly variable delay interval ("wait") from the onset of T. This variable delay means that the participant will have to respond repeatedly during T in order to gurantee that they make a response within the response window.
At present, the data file only shows whether a response was made within the respons window, and shows the response latency from the end of the wait interval. However, i would like to also record on each trial how many responses the participant made throughout the whole trial and also record what the random wait time was on that trial.

<picture Monkey>
/ items = monkey_picture
</picture>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<picture fillerpictures>
/ items = fillers
</picture>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ wait = 1000
/ window = 400
</values>

<trial T>
/ ontrialbegin = [values.wait = rand(100,1600)]
/ trialduration = 2000
/ stimulusframes = [1=Monkey]
/ validresponse = (57)
/ correctresponse = (57)
/ beginresponsetime = values.wait
/ isvalidresponse = [if(trial.T.latency<values.window) {values.points +=100}]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
            2-3 = noreplace(TESTblock, BlankBlock);
            4-5 = noreplace(TESTblock, BlankBlock);
            6-7 = noreplace(TESTblock, BlankBlock);
            8-9 = noreplace(TESTblock, BlankBlock);
            10-11 = noreplace(TESTblock, BlankBlock);
            12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>



If you use /beginresponsetime, then you cannot capture responses during the wait time, so the whole approach here is not suitable for what you want to do and you need to rethink it.

No responses are registered in the period before the specified beginresponsetime, that's the enitre point of beginresponstime. So, in order to begin capturing responses during the entire trial, including the wait period, you necessarily ought to set beginresponsetime to 0.

As for counting the number of space bar presses, see e.g. https://forums.millisecond.com/Topic22895.aspx#22899

As for logging any values, define a data element, specify its /columns and include values.wait, values.window, etc. there.

Here's a sketch of how to do this properly:

<text Monkey>
/ items = monkey_picture
/ erase = false
</text>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<text fillerpictures>
/ items = fillers
/ erase = false
</text>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ min_winRT = 0
/ max_winRT = 0
/ window = 400
/ spacebarcount = 0
/ latencies = ""
/ inwindowlatencies = ""
/ inwindow = false
</values>

<trial T>
/ ontrialbegin = [
    values.spacebarcount = 0;
    values.latencies = "";
    values.inwindowlatencies = "";
    values.min_winRT = round(rand(100,1600));
    values.max_winRT = values.min_winRT + values.window;
    values.inwindow = false;
    ]
/ trialduration = 2000
/ stimulusframes = [1=clearscreen, Monkey]
/ validresponse = (57)
/ iscorrectresponse = [
    return values.inwindow;
]
/ beginresponsetime = 0
/ isvalidresponse = [
    if (trial.T.response == 57) {
        values.spacebarcount += 1;
        values.latencies = concat(concat(values.latencies, trial.T.latency), ";");
        // check if latency is within window
        if (trial.T.latency > values.min_winRT && trial.T.latency < values.max_winRT) {
            //for the 1st one that is, we award points
            if (!values.inwindow) {
                values.points += 100;
                values.inwindow = true;
            };
            values.inwindowlatencies = concat(concat(values.inwindowlatencies, trial.T.latency), ";");
        };
        return false;
    };
]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=clearscreen, fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
    2-3 = noreplace(TESTblock, BlankBlock);
    4-5 = noreplace(TESTblock, BlankBlock);
    6-7 = noreplace(TESTblock, BlankBlock);
    8-9 = noreplace(TESTblock, BlankBlock);
    10-11 = noreplace(TESTblock, BlankBlock);
    12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode correct
    values.min_winRT values.max_winRT values.spacebarcount values.latencies values.inwindowlatencies values.points)
</data>


JustinH
JustinH
New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)New Member (34 reputation)
Group: Forum Members
Posts: 3, Visits: 21
Dave - 6/3/2023
Dave - 6/3/2023
JustinH - 6/3/2023
Dave - 6/2/2023
JustinH - 6/2/2023
I have a task in which the participant must make a response (eg, press space bar) after a variable (unknown) time interval within a trial. At present, i achieve this using / beginresponseframe to set the delay interval in each trial. This means that the participant should respond multiple times through the trial during the delay interval. For each trial, I would like to record the number of times the participant has responded. However, the data record only shows the RT and which key was pressed. Is it possible to add to the data file the number of times the response key was pressed?

Provide runnable example code, please. It's not clear what exactly you are doing and want to do based on the very barebones description you provided.

Hi Dave. I've copied some (cutdown) code below. It presents a sequence of jpg images (the full list has been cut here) and periodically a target image, T (a monkey). The subject is required to respond using the spacebar when T appears, but the response only wins points and feedback (not included in the script below) if it is made within a response window. The response window on each trial starts after a randomly variable delay interval ("wait") from the onset of T. This variable delay means that the participant will have to respond repeatedly during T in order to gurantee that they make a response within the response window.
At present, the data file only shows whether a response was made within the respons window, and shows the response latency from the end of the wait interval. However, i would like to also record on each trial how many responses the participant made throughout the whole trial and also record what the random wait time was on that trial.

<picture Monkey>
/ items = monkey_picture
</picture>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<picture fillerpictures>
/ items = fillers
</picture>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ wait = 1000
/ window = 400
</values>

<trial T>
/ ontrialbegin = [values.wait = rand(100,1600)]
/ trialduration = 2000
/ stimulusframes = [1=Monkey]
/ validresponse = (57)
/ correctresponse = (57)
/ beginresponsetime = values.wait
/ isvalidresponse = [if(trial.T.latency<values.window) {values.points +=100}]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
            2-3 = noreplace(TESTblock, BlankBlock);
            4-5 = noreplace(TESTblock, BlankBlock);
            6-7 = noreplace(TESTblock, BlankBlock);
            8-9 = noreplace(TESTblock, BlankBlock);
            10-11 = noreplace(TESTblock, BlankBlock);
            12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>



If you use /beginresponsetime, then you cannot capture responses during the wait time, so the whole approach here is not suitable for what you want to do and you need to rethink it.

No responses are registered in the period before the specified beginresponsetime, that's the enitre point of beginresponstime. So, in order to begin capturing responses during the entire trial, including the wait period, you necessarily ought to set beginresponsetime to 0.

As for counting the number of space bar presses, see e.g. https://forums.millisecond.com/Topic22895.aspx#22899

As for logging any values, define a data element, specify its /columns and include values.wait, values.window, etc. there.

Here's a sketch of how to do this properly:

<text Monkey>
/ items = monkey_picture
/ erase = false
</text>

<item Monkey_picture>
/ 1 = "monkey.jpg"
</item>

<text fillerpictures>
/ items = fillers
/ erase = false
</text>

<item fillers>
/ 1 = "001.jpg"
/ 2 = "002.jpg"
/ 3 = "003.jpg"
</item>

<values>
/ points = 0
/ min_winRT = 0
/ max_winRT = 0
/ window = 400
/ spacebarcount = 0
/ latencies = ""
/ inwindowlatencies = ""
/ inwindow = false
</values>

<trial T>
/ ontrialbegin = [
    values.spacebarcount = 0;
    values.latencies = "";
    values.inwindowlatencies = "";
    values.min_winRT = round(rand(100,1600));
    values.max_winRT = values.min_winRT + values.window;
    values.inwindow = false;
    ]
/ trialduration = 2000
/ stimulusframes = [1=clearscreen, Monkey]
/ validresponse = (57)
/ iscorrectresponse = [
    return values.inwindow;
]
/ beginresponsetime = 0
/ isvalidresponse = [
    if (trial.T.response == 57) {
        values.spacebarcount += 1;
        values.latencies = concat(concat(values.latencies, trial.T.latency), ";");
        // check if latency is within window
        if (trial.T.latency > values.min_winRT && trial.T.latency < values.max_winRT) {
            //for the 1st one that is, we award points
            if (!values.inwindow) {
                values.points += 100;
                values.inwindow = true;
            };
            values.inwindowlatencies = concat(concat(values.inwindowlatencies, trial.T.latency), ";");
        };
        return false;
    };
]
</trial>

<trial F>
/ trialduration = 1000
/ stimulusframes = [1=clearscreen, fillerpictures]
/ recorddata=false
</trial>

<block TESTblock>
/ trials = [1-2=F; 3-6=noreplace(T,F,F,F)]
</block>

<block BlankBlock>
/ trials = [1-2 = F]
</block>

<expt>
/ blocks = [1 = BlankBlock;
    2-3 = noreplace(TESTblock, BlankBlock);
    4-5 = noreplace(TESTblock, BlankBlock);
    6-7 = noreplace(TESTblock, BlankBlock);
    8-9 = noreplace(TESTblock, BlankBlock);
    10-11 = noreplace(TESTblock, BlankBlock);
    12-13 = noreplace(TESTblock, BlankBlock)]
</expt>

<defaults>
/ fontstyle = ("Arial", 3%)
/ txbgcolor = (transparent)
/ screencolor = (150, 150, 150)
</defaults>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode correct
    values.min_winRT values.max_winRT values.spacebarcount values.latencies values.inwindowlatencies values.points)
</data>


Thanks Dave. That's great

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search