Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Do coroutine stimuli get pre-loaded?

LJGSLJGS Posts: 34

I have noticed I am able to use variables that were calculated within a sequence to modify stimuli embedded in a coroutine in that sequence. Does that mean that these are not preloaded for each sequence? Would that affect the accuracy of timing? More important for me, would the stimulus time stamps be accurate?



  • sebastiaansebastiaan Posts: 2,889


    That's a good question. coroutines execute the Prepare phase of all the items in it as the first thing of the Run phase of the coroutines item itself.

    In terms of temporal precision, this means that the timing within coroutines is preserved, but there can be a slight delay (due to preparation) at the start of the coroutines. Does that make sense?

    And timestamps should always be accurate! So if there are temporal glitches, inspection of the timestamps should tell you that!


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • LJGSLJGS Posts: 34

    Awesome, thanks very much. I am interested more about the time within a coroutine for my RT measure, so I think I am all good.

  • LJGSLJGS Posts: 34

    Ah I now have another question about coroutine timing. I will chuck it here as well to not flood the forums!

    I am measuring eye RT to a stop-signal coroutine with the function embedded at the bottom

    I notice something a bit unexpected. The maximum time the coroutine can run is 2000ms (if no response recorded). However, when I set 'start' as I have it displayed below, my total RT (start -end) to a non-response trial is more like 1980ms (with some variability).

    In contrast, if I set the 'start' before the first yield in the coroutine (which I understand to be the initialization bit) the timing to non-responses will be exactly 2000ms as I would like. However, for these trials, if I respond instantly at the start of a trial (should yield 0ms), I get an RT of about 30, whereas the first method gives me 0 as it should. Thus I suspect this RT is including initialization time for the stimuli.

    From what I can tell, this means that time the coroutine will run according to my specification (2000ms) includes the initialization time. Is that what's going on here? If that is the case then the better measure of RT (in terms of time since stimulus was presented) would be the one I am currently using, not moving the 'start' time into the initialization phase right?

    I am using psycho back-end if that matters,


    def break_coroutines():
        response = None
        exp.set('response', None)
        exp.set('start', time.time())
        while True:
            localpos = eyetracker.sample()      
            if localpos[0]  < leftx:    
                response = 'left'
            elif localpos[0] > rightx:  
                response = 'right'      
            if response is not None:
                exp.set('end', end)
                exp.set('response', response)
                items['stop_signal_coroutines'].var.duration = 0
            keep_going = yield
            if not keep_going:
                if self.get('response') is None:
                    exp.set('end', end)
Sign In or Register to comment.