[visionegg] Re: Help on pattern reversal
- From: Andrew Straw <astraw@xxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Mon, 03 May 2004 23:36:33 -0700
alessandra.stella@xxxxxx wrote:
Hello!
I am using SinGrating2D to build a gabor for a visual perception experiment.
I need the gabor to have a temporal frequency of 6 Hz in a pattern reversal
mode, but the only function, for temporal frequency, I have using SinGrating2D
is drifting. Can you help me with that?
Thank you!
Alessandra
Dear Alessandra,
The temporal_frequency_hz variable is for moving the grating, as you
have discovered. You can vary contrast between -1 and 1 to acheive a
contrast reversal. I've included a modified version of the grating.py
demo which does this.
Cheers!
Andrew
#!/usr/bin/env python
"""Sinusoidal grating calculated in realtime."""
############################
# Import various modules #
############################
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation, FunctionController
from VisionEgg.Gratings import *
from math import sin, pi
#####################################
# Initialize OpenGL window/screen #
#####################################
screen = get_default_screen()
######################################
# Create sinusoidal grating object #
######################################
stimulus = SinGrating2D(position = ( screen.size[0]/2.0,
screen.size[1]/2.0 ),
anchor = 'center',
size = ( 300.0 , 300.0 ),
spatial_freq = 10.0 / screen.size[0], # units of
cycles/pixel
temporal_freq_hz = 0.0,
orientation = 45.0 )
###############################################################
# Create viewport - intermediary between stimuli and screen #
###############################################################
viewport = Viewport( screen=screen, stimuli=[stimulus] )
def contrast_controller( t ):
return sin(2*pi*t)
########################################
# Create presentation object and go! #
########################################
p = Presentation(go_duration=(5.0,'seconds'),viewports=[viewport])
p.add_controller(stimulus,'contrast',FunctionController(during_go_func=contrast_controller))
p.go()
- References:
- [visionegg] Help on pattern reversal
- From: alessandra . stella
Other related posts:
- » [visionegg] Help on pattern reversal
- » [visionegg] Re: Help on pattern reversal
Hello! I am using SinGrating2D to build a gabor for a visual perception experiment.
I need the gabor to have a temporal frequency of 6 Hz in a pattern reversal
mode, but the only function, for temporal frequency, I have using SinGrating2D
is drifting. Can you help me with that?
Thank you!
Alessandra
- [visionegg] Help on pattern reversal
- From: alessandra . stella