Visible Countdown Timer and Stimuli Progression

597 views
Skip to first unread message

Nike Tsalas

unread,
Mar 4, 2013, 11:04:39 AM3/4/13
to psychop...@googlegroups.com
Hi,

In my experiment participants have to manage their learning time.
Within a routine they have x amount of time for 20 stimuli.

My question is: how to I make the countdown timer visible for them on screen and ideally I would like to show them their progression on the stimulus list. i.e that they are now viewing the 16th stimulus pair out of 20  "16/20".
Within the routine which lasts for maximium 40 seconds, participants are able to move forward and backward through the stimuli list. I  added a loop.clock before the learning routine which gets checked during the routine and finishes the trial after 40 sec.
Do I need to change the loopclock to be a countdown timer instead? and how do I make it visible?

Many thanks!

Nike

Jeremy Gray

unread,
Mar 4, 2013, 11:45:42 AM3/4/13
to psychop...@googlegroups.com
Hi Nike,

you'll probably end up using a text component (or two), with some code
in the text box to format the remaining time and trial count
information (you'll need to use your own variable names instead of
loopClock and trialPairNumber):

$"%.1fs %i/20" % (40 - loopClock.getTime(), trialPairNumber)

--Jeremy
> --
> You received this message because you are subscribed to the Google Groups
> "psychopy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to psychopy-user...@googlegroups.com.
> To post to this group, send email to psychop...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/psychopy-users/-/DHxxMswpFdIJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Nike Tsalas

unread,
Mar 7, 2013, 5:54:00 AM3/7/13
to psychop...@googlegroups.com
Hi Jeremy, 

thanks for your reply, although I haven't quite figured it out yet.
from what I know so far about Psychopy I have to add the "(40 - loopClock.getTime(), trialPairNumber) " bit in a code component?! in the box every frame?
$"%.1fs  %i/20" % --> I wish I could say that I knew what this refers to and where to put it.

:(

Jeremy Gray

unread,
Mar 7, 2013, 7:09:46 AM3/7/13
to psychop...@googlegroups.com
Hi Nike,

Sorry, I should have elaborated more. I meant to put the whole expression:
$"%.1fs %i/20" % (40 - loopClock.getTime(), trialPairNumber)
inside the text box of a text component--but changing the variable
names to match your situation. Lets go through all of this in more
detail.

The first part "%.1fs %i/20" is just to format the numbers (%.1f
gives you 1/10th of a second, %.0f would give to the nearest second,
no fractional part) and the second part is the time and count info.
But you'll have to replace those variable names with ones that you
specify. We'll get to those below. The $ means "interpret this whole
text box as being python code". The whole thing goes in the text box
(no code components yet, only a text component.)

Call you loop "trials" (no quotes), then you can use "trials.thisRepN"
instead of "trialPairNum" above. (If you call it something else,
replace "trials" with your loop name.) You need to define your own
loopClock in a code component. So add a code component in a new
routine that you place just before the "trials" loop. It should be
outside the loop, not inside. In the code component, in the End
Routine box, put this line of code:
timer = core.CountdownTimer()
timer.add(40)

If you do this, then back in the text box, the exact code to put (in
the text box, not a code component), is:
$"%.1fs %i/20" % (timer.getTime(), trials.thisRepN)

Be sure to set that text box to update every frame.

--Jeremy
> https://groups.google.com/d/msg/psychopy-users/-/8C2p548NH7cJ.

Nike Tsalas

unread,
Mar 7, 2013, 12:56:42 PM3/7/13
to psychop...@googlegroups.com
Hi Jeremy,

thank you so much for taking the time to describe and explain this to me in detail,
I managed to set the countdown timer the way I wanted,

I think I have to fiddle a bit with the item count info,the trials.thisRepN is not working
and it only ever shows 0/20 for all items. I think it is because my list of picture stimuli are not coming from a csv file,instead I have listed the stimuli and coded the loop in a code component, because I
needed to be able to have participants go back and forth with the arrows and this is the way I managed to do it).
But I have an idea and will see how it goes :)

Thanks again for your help and time!

Nike
Reply all
Reply to author
Forward
0 new messages