[visionegg] Re: questions on eye - screen distance adjustment

Hi Alex,

The "p" you want is the parameters attribute of your Stimulus instance, not your Presentation instance. So, in your line 123 of gratingTCPmodSin02.py, change it to

self.parameters.spatial_freq = 1.0 / self.parameters.distance

(I frequently use a shorthand at the top of such functions p = self.parameters, and then this line would be "p.spatial_freq = 1.0 / p.distance" which is a bit simpler to read and also saves the Python interpreter from doing 2 name lookups.)

-Andrew

Alexandre Santos wrote:
Hi Andrew,

Thanks for your very useful tips (i'm indeed only using 2D stimuli at
the moment, no gabor). I have modified the gratingTCP according to
your instructions (I send it as an attachment), but I can't really
launch the script. I don't really understand why, but it seems
p.spatial_freq is out of scope in the Presentation object when I
modify it in ModSinGrating2D:

Traceback (most recent call last):
  File "gratingTCPmodSin02.py", line 155, in <module>
    p.run_forever()
  File "c:\python25\lib\site-packages\visionegg-1.1-py2.5-win32.egg\Vi
owControl.py", line 622, in run_forever
    self.between_presentations()
  File "c:\python25\lib\site-packages\visionegg-1.1-py2.5-win32.egg\Vi
owControl.py", line 665, in between_presentations
    viewport.draw()
  File "c:\python25\lib\site-packages\visionegg-1.1-py2.5-win32.egg\Vi
re.py", line 1340, in draw
    stimulus.draw()
  File "gratingTCPmodSin02.py", line 123, in draw
    p.spatial_freq = 1.0 / self.parameters.distance
AttributeError: 'Presentation' object has no attribute 'spatial_freq'

I don't really know why spatial_freq is out of scope in Presentation
and not before (for instance in Viewport), or why it is at all a
problem.

Cheers,
Alex


======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: