Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Timing of sketchpads in co-routines

edited February 20 in OpenSesame

Hi everyone,

I am running a time-sensitive experiment involving the presentation of two visual stimuli (250 ms) that then requires a simple button push upon the presentation of each of the visual stimuli. The response to the second visual stimuli is, however, speeded, and I want to ensure that the keyboard response item can detect the response in case the response occurs while the visual stimuli is still present. For this purpose, I inserted both into a co-routine (see first picture, design 1). Doing this and checking the timing of the presentation, I get both varied and surprising latencies. When the duration is set to 249, the calculated presentation of the visual stimuli was 239-245 ms from 12 trials and 242-247 ms from 12 trials when set to 251.
When I remove those three items from the co-routine and insert them directly into the trial sequence (see picture 2, design 2), the duration of the stimuli presentation is 250 ms across all 12 trials. This doesn't solve my issue of needing to have the keyboard response active during the presentation of the visual stimuli, but does indicate that having the sketchpad in the co-routine leads to the odd results.
I suspect the issue is that the sketchpad needs to be prepared and presented when the co-routine runs, and isn't prepared with the whole trial sequence as is the first visual stimuli. Would anyone be able to confirm if that is the case and/or suggest a way to make this work?

Many thanks in advance,
Kyran.

Design 1

Design 2

Comments

  • Hi,

    I can't confirm what you say (simply because I don't know). A workaround could look like this (using inline_scripts):

    cv = Canvas()
    blank_cv = Canvas()
    kb = Keyboard()
    
    # define and shuffle the word list
    word = 'stuff'
    # define durations of each phase
    non_duration = 240
    blank_duration = 245
    
    # list to collect all the responses
    var.resps = []
    
    # draw the first word 
    phase = 1
    cv['word'] = Text(word)
    t1 = blank_cv.show() # start_timer
    while True: 
        # get the key presses
        k,t = kb.get_key(timeout = 1)
        if k != None:
            var.resps.append([k,t])
            break
        # show a blank and draw the next word
        if clock.time()-t1>blank_duration and phase == 1:
            phase = 2
            cv.show()
    

    Does this make sense?

    Eduard

Sign In or Register to comment.