[SciPy-user] New named fields in scipy core --- possible uses in color images

Travis Oliphant oliphant at ee.byu.edu
Thu Dec 15 18:03:38 CST 2005


Gary Ruben wrote:

>I think this named record feature will be quite popular. I was expecting 
>that fields would be accessed using a syntax like image.r image.g etc. 
>However, using strings as Travis has done suggests other possibilities 
>for accessing slices such as image['rgb'] or image['r','g','b'] and 
>perhaps image['g','b','r']. Just putting this out to see if it's a good 
>idea,
>  
>
The recarray subclass implements attribute access so that you could 
access the fields as

image.r
image.g
image.b

and so forth.   But, such records are always subclasses of the void 
data-type.  Thus, you couldn't do math with them as a whole (you can do 
math with the fields though).  

-Travis




More information about the SciPy-user mailing list