We want to write a code that records the duration of infants looking behaviour when they look at a fixed image on the left or right of the screen.
A trial starts with an image on the left or right screen, and we play a continuous stream of auditory samples until the infant looks away 2s.
We want to record the infant attention to the stimulus; however, we want to move subsequent trial if the infant looked away more than 2s.
We use the ‘up’ key to record looking behaviour, but there is a problem between actual time because it does not look normal. Please see the message I got when I ran the study.
########### Running: C:\Users\Infant Lab\Desktop\HSs\HSsS_lastrun.py ###########
17014.4448 INFO Loaded monitor calibration from [‘2021_05_18 12:31’]
Hello from the pygame community. https://www.pygame.org/contribute.html
up 268626.6679573 0.7888032999471761
up 268630.5078914 4.628737399994861
up 268634.8439907 8.964836700004525
up 268638.131816 12.252661999955308
up 268641.507716 15.628561999998055
up 268644.3395635 18.460409499995876
My supervisor has kindly helped me writing the code, but I assume there is a problem between actual time and recording time.
Please see the code below and help me to fix it.
from psychopy.hardware import keyboard
for thisKey in keys:
print(thisKey.name, thisKey.tDown, thisKey.rt)
if thisKey.tDown - clock.getAbsTime() >2:
Many thanks in advance.