Howdy, Stranger!

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

Supported by

[open] Flickering stimulus generation (custom shape with checkerboard fill at a certain freq)

edited April 2014 in OpenSesame

I would like to generate images with a flickering on-off rate of 8Hz. What would be the best way to go about doing this? The shapes are not the standard masks although the pattern fill would be checkerboard. Is there a way to verify that the flicker rate on my system was close to 8Hz?

I just came across Opensesame with the psychopy backend but am unsure the best way to proceed or if I can access pre-built checkerboards and then just use an alpha mask of the shape to generate my desired stimulus

-sb

Comments

  • edited 6:15AM

    Is there a way to verify that the flicker rate on my system was close to 8Hz?

    If you use a back-end that uses a blocking flip (see Timing documentation), the timestamps that you get for your display presentation are fairly accurate. Below you see an example script that shows how you can determine the flicker rate of two alternating stimuli using the PsychoPy back-end. However, to be absolutely sure of your timing you will need to benchmark your system with a photodiode.

    Example script:

    import numpy as np
    from psychopy.visual import GratingStim
    
    # Create two stimuli
    stim1 = GratingStim(win, size=128, color=1)
    stim2 = GratingStim(win, size=128, color=0)
    
    # Alternately present the stimuli and log the timestamp after each window flip
    lT = []
    for i in range(100):
        stim1.draw()
        win.flip()
        lT.append(self.time())
        stim2.draw()
        win.flip()
        lT.append(self.time())
    
    # Use numpy to determine the difference between subsequent timestamps and print
    # this info to the debug window.
    aT = np.array(lT)
    aDiff = aT[1:] - aT[:-1]
    print 'M = %.2f, SD = %.2f' % (aDiff.mean(), aDiff.std())
    

    I just came across Opensesame with the psychopy backend but am unsure the best way to proceed or if I can access pre-built checkerboards and then just use an alpha mask of the shape to generate my desired stimulus

    That depends on your specific stimuli, of course. But if you want familiarize with the use of masks and textures in PsychoPy, you may want to take a look at this tutorial:

    Cheers!
    Sebastiaan

Sign In or Register to comment.