|
From: Stefan v. d. W. <st...@su...> - 2006-02-16 21:54:23
|
On Thu, Feb 16, 2006 at 02:06:15PM -0700, Travis Oliphant wrote:
> Stefan van der Walt wrote:
>=20
> >Is there any way to control the underlying storage for a record?
> >
> >I am trying to use Travis' earlier example of an image with named fiel=
ds:
> >
> >dt =3D N.dtype('<f12', [('r','<f4'),('g','<f4'),('b','<f4')])
> >img =3D N.array(N.empty((rows,columns)), dtype=3Ddt)
> >
> >Using this, I can access the different bands of the image using
> >
> >img['r'], img['g'], img['b'] (but not img.r as mentioned in some of
> >the posts).
> >=20
> >
> Attribute lookup (img.r) is the purpose of the record array subclass.
>=20
> rimg=3D img.view(numpy.recarray)
>=20
> rimg.r --- will now work.
Thanks for the quick response! This is very useful information.
Regards
St=E9fan
|