A problem between stimulus onset, keyboard response and RT recording

Hey guys! I would Appreciate it if you can give me some advices to solve the problem. I’ve tried a lot but there exists problems all the time.

  • Functions that I want to achieve:
    First, the stimulus will be presented for 300ms, which is a fixed duration;
    Second, the keyboard response will be considered as valid response when the RT is less than 1000ms since the stimulus presentation. Besides, the keyboard response is admitted once the stimulus is presented no matter whether it is still on the screen or not, which means that there are two possibilities: particpants press the key within the deadline of stimulus onset as well as out of the deadline.

  • Problems:
    I coded in this way at first:


    When I run this script, the stimulus won’t disappear until the deadline (maxWait=1) of event.waitKeys. Thus, it is not what I want. Then I changed the code to achieve the functions I want:

    But now, although this script can nearly achieve the function of presenting the stimulus in 300ms and getting MOST keyboard response, there is a strange thing: despite the participants responded to every stimuli, the data collected in this pre-experiment showed us some ‘miss’ trials in which we failed to collect the RT data. I assume that the reason may be that there is a gap between two lines of ‘event.waitKeys’ so that the script can only judge it as a ‘miss’ trial.

If anyone have the same problem or have any solution, please do reply!!! It would help me a lot!!!

Hi There,

Since this sounds like a reasonably simple trial progression, I would recommend making this in Builder view. It will be much faster to make and the timing will all be optimized, for example here you will be polling response times per frame rather than using the better timing of the keyboard class. I think you might also want to be using the autodraw functions rather than draw. If you chose to stay with coder this tutorial gives details on polling responses with the keyboard class as well as using autodraw methods which should help Improvements — Workshops for PsychoPy 2020 2020

Hope this helps,
Becca

1 Like

Thanks a lot for your help! Actually I found Coder easier to organize my experiment script at first. I know builder is stricter with the process of experiments. If I use builder now, there will be more things that remain to be solved (providing different feedback according to the conditions that we care, for example) I think I will think about it and give it a try. Thank you so so much!

Thanks a lot for your help! Actually I found Coder easier to organize my experiment script at first. I know builder is stricter with the process of experiments. If I use builder now, there will be more things that remain to be solved (providing different feedback according to the conditions that we care, for example) I think I will think about it and give it a try. Thank you so so much!

Code components in Builder are fine and will be the direction you need to take if you decide to put your experiment online. Coder is for local experiments only.