Hello, I'm planning to use VisionEgg for my experiments, and the script gratingTCP.py fits nearly all my needs except for one thing: The distance between the mouse and the screen is not always the same, and I need to create a new parameter (distance) so that the spatial_freq parameter remains consistent for different mouse distances from the screen. This brings me two questions: 1) Which parameter should I adjust? Initially I wanted to manipulate spatial_freq or size directly with distance, but according to the documentation (p.9 of http://visionegg.org/visionegg.pdf) size is expressed in arbitrary eye coordinate units and converted to pixel coordinates through a Projection class. If so, it makes more sense to manipulate this projection class with the distance parameter than size or spatial_freq which refer to arbitrary eye coordinates. The problem is that while reading the SinGrating2D source code I saw no reference to this Projection class, it seems that the documentation is either outdated or not yet implemented. Unless I completely misunderstood the code, the projection is directly calculated in SinGrating2D itself through the floating_point_sin variable. Should I adjust for distance at the following line of code? floating_point_sin = numpy.sin(2.0*math.pi*p.spatial_freq*numpy.arange(0.0,w,inc,dtype=numpy.float)+(phase/180.0*math.pi))*0.5*p.contrast+p.pedestal 2) How to implement the change? Unfortunately I'm learning python as I learn to use VisionEgg, so this question is more python than VisionEgg related - sorry for the bother: once I figure out how to correct spatial frequency for distance I could simply copy SinGrating2D to gratingTCP.py and modify it accordingly. But this solution is cumbersome and not very sustainable. Since SinGrating2D is an object, I guess the best would be to use a new object which would inherit from SinGrating2D, but with the added distance parameter. Would the following syntax work? gratingTCP.py: [snip] # Create a new class modified from SinGrating2D class ModSinGrating2D(SinGrating2D): """ Modified SinGrating2D allowing to enter mouse distance from screen in cm """ def __init__(self, distance = None): """ if distance not specified don't bother adjusting spatial frequency """ self.distance = distance # the following adjustment is totally wrong, I'm just using it as an example if self.distance: p.spatial_freq = 1.0 / ( 2.0 * self.distance * numpy.tan( ( ( 1.0 / p.spacial_freq ) * numpy.pi / 180.0 ) / 2.0 ) * 1024.0 / screen.size ) # Create the instance SinGrating with appropriate parameters stimulus = ModSinGrating2D(anchor='center') [snip] Regards, Alexandre Santos ====================================== The Vision Egg mailing list Archives: //www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html