[visionegg] sorry, here the attachment (.txt)
- From: Christoph Lehmann <christoph.lehmann@xxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 03 Dec 2002 22:17:07 +0100
christoph
--
========================================
Christoph Lehmann
University of Berne
christoph.lehmann@xxxxxxxxxxxx
--------------------------------------------------
This mail sent through IMP at http://mail.unibe.ch
-- Attached file included as plaintext by Ecartis --
-- File: ve_mail.txt
Hi Andrew
I successfully ran the code you wrote together with Joyca (running it with my
Redhat, while Joyca runs it in Windows: I LOVE platform-independence):
the code
-------------
#!/usr/bin/env python
"""Load a picture from a file."""
from random import *
import os
from VisionEgg import *
from VisionEgg.Core import *
from VisionEgg.Textures import *
path = "/home/christoph/VisionEgg/my_ve_projects/load_picture/data/" #the path
the images are in
photo = []
photoX = []
# present them in random order
for filename in os.listdir(path):
   photo.append(filename)
length = len(photo)
for i in range(0, length):
   ran = randint(0, len(photo)-1)
   file = photo[ran]
   photoX.append(file)
   photo.pop(ran)
os.chdir(path)
screen = get_default_screen()
duration_per_image = 0.5 # seconds
num_images = len(photoX)
# Create list of stimuli
preloaded_stimulus_list = [] # empty at first
for i in range(num_images):
   # Read the texture file
   texture = TextureFromFile(photoX[i])
   # Load the texture to OpenGL, prepare for display
   stimulus = TextureStimulus(texture = texture,
                              size =
(texture.orig.size[0]*2,texture.orig.size[1]*2),
      shrink_texture_ok=1)
   #texture.orig.size
   # Add to list of stimuli
   preloaded_stimulus_list.append( stimulus )
def image_selector( t ):
   i = int(t/duration_per_image)
   return [ preloaded_stimulus_list[i] ]
viewport = Viewport(screen=screen)
p = Presentation(go_duration=(duration_per_image *
num_images,'seconds'),viewports=[viewport])
p.add_controller(viewport,'stimuli',
FunctionController(during_go_func=image_selector) )
p.go()
-------------
running the code with max priority as su I got (after correcting the Core.py
with your fix):
VisionEgg info (2002-12-03 21:43:14): Requesting window 640 x 480 24 bpp (8 8 8
0 RGBA).
VisionEgg info (2002-12-03 21:43:14): OpenGL 1.2 Mesa 3.4.2, Mesa DRI Radeon
20010402 AGP 1x
   x86/MMX/SSE, VA Linux Systems, Inc.
VisionEgg info (2002-12-03 21:43:14): Video system reports 32 bpp (8 8 8 8
RGBA).
VisionEgg info (2002-12-03 21:43:14): Setting maximum priority for POSIX
platform.
Traceback (most recent call last):
 File "load_picture.py", line 36, in ?
 File "/usr/lib/python2.2/site-packages/VisionEgg/Textures.py", line 201, in
__init__
   self.orig = Image.open(file)
 File "/usr/lib/python2.2/site-packages/PIL/Image.py", line 975, in open
   prefix = fp.read(16)
IOError: [Errno 21] Is a directory
----------
when running as normal user (not su) I get:
VisionEgg info (2002-12-03 21:45:18): load_picture.py started.
VisionEgg info (2002-12-03 21:45:23): Requesting window 640 x 480 24 bpp (8 8 8
0 RGBA).
VisionEgg info (2002-12-03 21:45:23): OpenGL 1.2 Mesa 3.4.2, Mesa DRI Radeon
20010402 AGP 1x
   x86/MMX/SSE, VA Linux Systems, Inc.
VisionEgg info (2002-12-03 21:45:23): Video system reports 32 bpp (8 8 8 8
RGBA).
VisionEgg info (2002-12-03 21:45:23): Setting maximum priority for POSIX
platform.
Traceback (most recent call last):
 File "load_picture.py", line 27, in ?
 File "/usr/lib/python2.2/site-packages/VisionEgg/Core.py", line 444, in
get_default_screen
   return Screen.create_default()
 File "/usr/lib/python2.2/site-packages/VisionEgg/Core.py", line 413, in
create_default
   hide_mouse=VisionEgg.config.VISIONEGG_HIDE_MOUSE)
 File "/usr/lib/python2.2/site-packages/VisionEgg/Core.py", line 324, in
__init__
   PlatformDependent.set_realtime()
RuntimeError: sched_setscheduler returned EPERM (Permission error. Do you have
permission; are you superuser?)
----
that's it. hope the traceback helps you.
by the way: how to tell VE to show the jpgs centered on the screen (well I can
look in the ref, but if you anyway read my mail :) )
the next thing I want to do is to get the mouse response of the user for each
pic shown and save it to a file ... no idea yet, how to do, but this will be my
next endeavor :).. again here: if this will be very easy and you just have
another minute to drop a line, thanks. otherwise I will experiment on my own :)
what about making a pool with all experiments, designed by people using your
great VisionEgg?
salutations
christoph
On Mon, 2002-12-02 at 23:13, Andrew Straw wrote:
>
> Hi Christoph,
>
> I've just found a bug in "check_gl_assumptions()" of VisionEgg.Core
> which I think may be part of the problem. (Could you please include a
> traceback next time?) I can't access CVS at the moment to check in my
> fix, but if you change "check_gl_assumptions()" your Core.py to the
> following, it should solve that problem. I will check this into CVS as
> soon as I can.
>
> ******************************
> def check_gl_assumptions():
> """Called by Screen instance. Requires OpenGL context to be
> created."""
> for gl_variable,required_value,failure_callback in gl_assumptions:
> # Code required for each variable to be checked
> if string.upper(gl_variable) == "GL_VENDOR":
> value =
> string.split(string.lower(gl.glGetString(gl.GL_VENDOR)))[0]
> if value != required_value:
> failure_callback()
> elif string.upper(gl_variable) == "GL_VERSION":
> value_str = string.split(gl.glGetString(gl.GL_VERSION))[0]
> value_ints = map(int,string.split(value_str,'.'))
> value = float( str(value_ints[0]) + "." +
> string.join(map(str,value_ints[1:]),''))
> if value < required_value:
> failure_callback()
> ******************************
>
> Cheers!
> Andrew
>
> On Monday, December 2, 2002, at 10:10 PM, Christoph Lehmann wrote:
>
> >
> > running VE as root with max priority I get:
> >
> > execption: "failure_string" not defined
> >
> > ?
> > thanks
> >
> > christoph
> >
> > --
> > Christoph Lehmann
> > Department of Psychiatric Neurophysiology
> > University Hospital of Clinical Psychiatry
> > Waldau
> > CH-3000 Bern 60
> > Switzerland
> >
> > Phone: ++41 31 930 93 83
> > Fax: ++41 31 930 96 61
> > Email: lehmann@xxxxxxxxxxxx
> > Web:
> >
> > ======================================
> > The Vision Egg mailing list
> > Archives: http://www.freelists.org/archives/visionegg
> > Website: http://www.visionegg.org/mailinglist.html
>
> ======================================
> The Vision Egg mailing list
> Archives: http://www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
--
Christoph Lehmann
Department of Psychiatric Neurophysiology
University Hospital of Clinical Psychiatry
Waldau
CH-3000 Bern 60
Switzerland
Phone:Â ++41 31 930 93 83
Fax:Â Â Â ++41 31 930 96 61
Email:Â lehmann@xxxxxxxxxxxx
Web:Â Â Â
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] image_sequence.py
- From: Joyca Lacroix
Other related posts:
- » [visionegg] sorry, here the attachment (.txt)
- [visionegg] image_sequence.py
- From: Joyca Lacroix