[visionegg] Re: mirroring a text strimulus?

Dav Clark wrote:
> Andrew - couldn't you also use numpy.asarray on self.texels?  This would
> also have the benefit of the same behavior for ndarrays as well as
> Image.Image and pygame.surface.Surface objects.  Namely, they would all
> be a view on the actual data held by the Texture object.

That would be very nice. Do pygame.surface.Surface objects and
Image.Image objects support the numpy array interface (or the 2.6/3.0
buffer interface specified by PEP-3118)? Regardless if they don't yet,
it would be nice to use that path as the default, only falling back to
my path if that fails.

> Likewise, is there a reason that you don't use Image.fromarray in
> get_texels_as_image?  Same arguments for uniformity apply.

The only reason is history -- I think I wrote that before PIL had a
fromarray function. Likewise this could be the default and fallback on
what is presently there only if that is not implemented.

> Happy to submit a patch if you'd like - either via git or svn diff.  Or
> otherwise let me know where my thinking is wrong here!

That would be great. I'm sticking with plain svn for now until I figure
out a problem I've been having interacting with the svn repo via git-svn
using a clone of the git repo hosted at github. I have git and svn
working well for a few other projects, so I'm not sure what the trouble
is, but the situation is not helped by the VE's long and tortured
version control history (starting with CVS, converted to SVN without
trunk/branches/tags if I recall correctly, having in fact 2 projects in
the same repo -- VE and Quest).

> 
> Cheers,
> DC
> 
> On Nov 18, 2008, at 1:54 PM, Andrew Straw wrote:
> 
>> Hi Gary,
>>
>> I just added such functionality including a demo script. The new demo
>> can be seen at
>> http://visionegg.org/trac/browser/trunk/visionegg/demo/texture_as_numpy_array.py
>>
>>
>>
>> This will require the latest VE from svn, however. If that's a pain, you
>> should just be able to take the latest VisionEgg/Textures.py from the
>> source repository and overwrite the version in your installation. Test
>> it with the new demo script.
>>
>> -Andrew
>>
>> Gary Lupyan wrote:
>>> Thanks!  Do you know offhand what the command is for converting Texture
>>> to a numpy buffer and back?
>>>
>>> -Gary
>>>
>>>
>>> On Tue, Nov 18, 2008 at 3:17 PM, Dav Clark <davclark@xxxxxxxxxxxx
>>> <mailto:davclark@xxxxxxxxxxxx>> wrote:
>>>
>>>    It would be trivial to take your texture as a numpy buffer or
>>>    similar and flip it (in numpy) and create a second stimulus with
>>>    that.  There would be an OpenGL way to do it also, but I don't know
>>>    off the top of my head...
>>>
>>>    reversing in numpy:
>>>
>>>    swapd = a[:,::-1]
>>>
>>>    Cheers,
>>>    Dav
>>>
>>>
>>>    On Nov 18, 2008, at 11:26 AM, Gary Lupyan wrote:
>>>
>>>        Hey everyone, is there a way to flip (i.e., mirror) a texture
>>>        stimulus about the x or y axis?
>>>
>>>        Thanks.
>>>
>>>
>>>    ======================================
>>>    The Vision Egg mailing list
>>>    Archives: http://www.freelists.org/archives/visionegg
>>>    Website: http://www.visionegg.org/mailinglist.html
>>>
>>>
>>
>>
>> -- 
>> Dr. Andrew D. Straw
>> California Institute of Technology
>> http://www.its.caltech.edu/~astraw/
>> ======================================
>> 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


-- 
Dr. Andrew D. Straw
California Institute of Technology
http://www.its.caltech.edu/~astraw/
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: