Task duration - how to make sure the loop is approximately 10 minutes

I am trying to determine the duration of the entire routine so that it is approximately 10 minutes long. How can I do that? Should I get the starting time for the last stimuli in the routine? In my case it is a text so I could something like this:

if Feedback.started > 600:
continueRoutine = True
else:
continueRoutine = False

But I am not sure it would work since it still requires a value on the loop for the number of repetitions.

Hi,

I guess you don’t really mean the duration of a routine (since that is just determined by the duration of the components within it), but the duration of multiple presentations of a routine within a loop (i.e. where each presentation of a routine is much less than ten minutes, but you want to limit the total number of presentations)?

If so, see this:

and then you could have code that looks something like this:

if your_clock_name.getTime() >= 600:
    continueRoutine = False
    your_loop_name.finished = True

If that code is in the “each frame” tab of a code component, then it would end the routine and the loop at exactly ten minutes. If it is in the “begin routine” or “end routine” tabs, then it wouldn’t be as accurate (because the last routine might run past ten minutes), but the routine wouldn’t end part way through.

Thank you for responding and sorry for, once again, not providing enough detail!

The problem is I am programming a psychomotor vigilance task and I have to reset the clock every trial because I am using it as a counter for each trial. As in, each trial consists in the presentation of the counter until the participant responds, once he does, he gets feedback, i.e. how long he took to stop the stopwatch. So I unfortunately cannot continue to use the clock until it reaches 10 minutes (I think).

You can create as many timers as you need. e.g. one that runs within a trial, and gets reset as required, and one that spans multiple trials.

Builder will already create one for each routine, which you can piggyback off if you need.

Thank you, again! Please let me know if I can ever be helpful to you.

You’re welcome. Your question is itself of value to community - many other people with the same issue will hopefully be able to find it by Google.

1 Like