Getting a total loop time on a break keystroke.

42 views
Skip to first unread message

Lazaros Gonidis

unread,
May 30, 2013, 6:54:33 PM5/30/13
to psychop...@googlegroups.com
Hello guys.

I am designing an experiment and one of the trials is a stroop and I want the participant to stop the Stroop when they wish by hitting "return".
I have added the lines
if event.getKeys(["return"]):
    trial.finished = True

and it works fine. the trial finishes and I move forward. However, I want to log the total time that the participant has spent on that specific Stroop trial. Any ideas on how I could that?
I experimented with clocks but no luck so far.

Thank you,

Lazaros.

Jonas Lindeløv

unread,
Jun 1, 2013, 5:26:25 PM6/1/13
to psychop...@googlegroups.com
Hi Lazaros

You would reset the clock at the beginning of the trial and then record the elapsed time when return is pressed. So it would contain some of these elements:

# Initiate clock
trialClock = core.Clock()

# Loop through trials
for trial in trialList:
   # Present trial
   stim.draw()
   win.flip()
   trialClock.reset()
   
   # Record response
   response = event.getKeys(['return', 'r', 'g', 'b'])  # allowed responses
   if response:
      trial['rt'] = trialClock.getTime()
      if response[0] == 'return': trial.finished = True
      if response[0] in ['r','g','b']: trial['answer'] = response[0]

Lazaros Gonidis

unread,
Jun 3, 2013, 6:30:22 PM6/3/13
to psychop...@googlegroups.com
Thank you for your reply Jonas,

I am afraid I phrased my question in a wrong way. I want the elapsed time for the total duration of the Stroop. So lets say if the participant already responded for the first 10 stimuli and then press Return I would like to know exactly how low he/she stayed in the loop.
Do you think it would work if I do not reset and I get the clock as soon as return is pressed?

Jeremy Gray

unread,
Jun 3, 2013, 10:01:24 PM6/3/13
to psychop...@googlegroups.com
I am afraid I phrased my question in a wrong way. I want the elapsed time for the total duration of the Stroop. So lets say if the participant already responded for the first 10 stimuli and then press Return I would like to know exactly how low he/she stayed in the loop.
Do you think it would work if I do not reset and I get the clock as soon as return is pressed?

well, did you try it? :-)

--Jeremy

Lazaros Gonidis

unread,
Jun 4, 2013, 4:47:48 AM6/4/13
to psychop...@googlegroups.com
I tried it and works perfectly fine.
Thanks for the help everyone.

Lazaros.
Reply all
Reply to author
Forward
0 new messages