psychopy.org | Reference | Downloads | Github

First key press not registering some of the time (rapid presentation of stimuli)

Hello everyone,

I have set up a perceptual decision task, where a sequence of stimuli/samples flashes on the screen (presentation rate between two consecutive stimuli is approx. 200ms) and the participant needs to make a keypress at any point during the sequence, to indicate whether more samples appear on the left or right side of the screen. The presentation of a single sample occurs within a routine (pictured below), which is ran by a loop that terminates once a keyboard response has been made.


Builder loop

Now, this all works as it should - except that, on some trials (1/10 or so) the first key press does not register at all and the key has to be pressed again. Of course, this inflates the actual response times and contaminates my data, which is why I would like to solve this issue. I suspect that this happens whenever the key is pressed ‘between loops’ - after Sample X has ended, but before Sample X+1 started. If my intuition is correct, then this issue could by solved by removing the stimulus-presenting loop, and instead include the sequence of stimuli in one routine. This, however, would be cumbersome and probably cause further complications, since I would be unable to select stimuli from the conditions file, the way I do now using a loop.

My question is, has anyone encountered a similar issue and would be able to advice me on what to do? Is there perhaps a way to move the keyboard component ‘a level up’ so that it is not tied to the ‘samples’ loop, but instead starts at the beginning of the ‘trial’ loop and operates in parallel with the samples-presenting routine?

Many thanks in advance for any tips!

Hello,

well, I have a change-blindness experiment in which I switch between altered and unaltered picture until participants react or one minute has passed. Both pictures are separated by a mask. So, there is no need to have a sample loop and a trials loop. Could that suit you needs?

Best wishes Jens

Hi Jens,

Thank you very much for stopping by. That does sound like something I would like to achieve! Would you happen to have the PsychoPy project for that experiment around, or remember how exactly you achieved it?

Best, Erik

Hello Erik,

what is your gitlab-account name? I add you as a developer and you can fork the project. Alternatively, look here

wakecarter deserves the credit for the code and approach.

Best wishes Jens

Dear Jens,

I think seeing the whole worked example would be most helpful! If you don’t mind, would you be able to add me on github (ErikStuchly)? Thanks a lot!

Best,
Erik

Hello,

you have been added.

Best wishes Jens

Hello Jens,

My apologies, I mixed up Github and Gitlab - I used the same email address for both, however, my usernames differ and the one I provided was for Github. So actually, my Gitlab user name is @Erik1998 - would you be so kind as to replace the previous account with this one?
Many thanks in advance!

Are you clearing events or getting keyboard responses in your code component?

@wakecarter The code component does handle quite a lot of stuff; however, most of these have to do with keeping track of remaining time on the task, getting information about each presented stimulus (e.g. whether it appeared on the left or right, its ordinal number in that particular trial, whether a key was pressed during the presentation of that stimulus or not) and selecting the location of the subsequent stimulus (i.e. whether it appears in the upper or lower quadrant of the screen).
The key response is obtained through the ‘keyboard’ component in my routine and the only lines of code that relate to it are the following, which register whether a valid key was pressed or not (the former terminates the stimulus-presentation routine and loop):

if ((loop_resp.keys != undefined) && (loop_resp.keys.length > 0)) {
    samples.finished = 1;
    continueRoutine = false
    action = 1
    arm_feedback.setOri(clockori);
}

@ErikS

I added Erik Stuchly @ErikStuchly. Isn’t it you? No match is found for @Erik1998

Best wishes Jens

My apologies Jens, it seems I checked my other account, completely forgetting about this one… I can see the project now, I will take a look and make a post about whether I found a solution or not. Many thanks once again!