[visionegg] Re: timing in vision egg

Dear Andrew,

Thank you very much for your time and help. I really appreciate that!

When trying to use the code you send me I find the following error in the
log file:
*************************************************
VisionEgg info (2002-11-22 11:39:34): C:\Documents and Settings\j.lacroix\My
Documents\python\stimuli.py
    started.
VisionEgg info (2002-11-22 11:39:41): Requesting window 768 x 576 32 bpp (8
8 8 0 RGBA).
VisionEgg info (2002-11-22 11:39:41): OpenGL 1.3.1, GeForce2 MX/PCI/SSE2,
NVIDIA Corporation
VisionEgg info (2002-11-22 11:39:41): Video system reports 32 bpp (8 8 8 0
RGBA).
Traceback (most recent call last):
  File "C:\Documents and Settings\j.lacroix\My Documents\python\stimuli.py",
line 36, in ?
    texture = TextureFromFile(photoX[i])
  File "C:\Python22\Lib\site-packages\VisionEgg\Textures.py", line 201, in
__init__
    self.orig = Image.open(file)
  File "C:\py22\PIL\Image.py", line 960, in open
    raise IOError, "cannot identify image file"
IOError: cannot identify image file
************************************
Would you be so kind to help me with this problem?

Thank you very much in anticipation!

Kind regards,
Joyca Lacroix

j.lacroix@xxxxxxxxxxxxx


----- Original Message -----
From: "Andrew Straw" <andrew.straw@xxxxxxxxxxxxxxx>
To: <visionegg@xxxxxxxxxxxxx>
Sent: Friday, November 22, 2002 2:15 AM
Subject: [visionegg] Re: timing in vision egg


>
> Hi Joyca,
>
> It's within a single "go loop" that the Vision Egg is able to maintain
> timing accuracy, but your code starts a "go loop" each time you want to
> display a new stimulus.  The go loop itself is lasting the duration you
> specify. Because your program doesn't clear the screen after the go
> loop finishes, the last frame drawn is displayed for too long -- the
> duration it takes for the next go loop to start.  In this case, an
> image must be read in from file, so it takes a while.  The simplest
> solution is to pre-load all your images like this:  (This would
> minimize the wait, although it still may not be absolutely temporally
> precise because multiple go loops are still spawned.)
>
> *****************************************************
> preloaded_stimulus_list = []
> for i in range(0, len(photoX)):
>      texture = TextureFromFile(photoX[i])
>      stimulus = TextureStimulus(texture = texture,
>                             size    = texture.orig.size,
>                             shrink_texture_ok=1)
>      preloaded_stimulus_list.append( stimulus )
>
> viewport = Viewport(screen=screen)
> p = Presentation(go_duration=(0.5,'seconds'),viewports=[viewport])
>
> for i in range(0, len(photoX)):
>      viewport.parameters.stimuli = [preloaded_stimulus_list[i]]
>      p.go()
> *****************************************************
>
> The "ultimate" way would be to do everything in a single go loop,
> thereby ensuring timing across all your images.  This requires a
> Controller to select the image used.
>
> *****************************************************
> 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,
>                          shrink_texture_ok=1)
>
>      # 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()
> *****************************************************
>
> Hopefully this helps.
>
> Cheers!
> Andrew
>
> On Thursday, November 21, 2002, at 09:08  PM, Joyca Lacroix wrote:
>
> > L.S.
> >
> > Currently I'm working on a psychological experiment in which I present
> > (timed) images of faces (tif format). I'm trying to present the images
> > in a sequence, every image for 1 second. Because I have only just
> > begun using vision egg I took one of the demo's in the VisionEgg
> > folder as a strating point (texture.py).
> > I notice that when I present the pictures, the timing becomes less and
> > less precise (after a few images the presentation takes up to 2 sec.
> > and this delay becomes larger and larger)
> > here is part of my code:
> > ************************************************
> > for i in range(0, len(photoX)):
> >     texture = TextureFromFile(photoX[i])
> >     stimulus = TextureStimulus(texture = texture,
> >                            size    = texture.orig.size,
> >                            shrink_texture_ok=1)
> >     viewport = Viewport(screen=screen,
> >                     stimuli=[stimulus])
> >     p = Presentation(go_duration=(0.5,'seconds'),viewports=[viewport])
> >
> >     p.go()
> > *****************************************************
> >
> > Can you help me get the timing more precise? (the problem is not my
> > videocard)
> >
> > Thank you in anticipation
> > Greetings, J.L.
> >
> > j.lacroix@xxxxxxxxxxxxx
> > ======================================
> > 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
>

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

Other related posts: