|
From: Stefan v. d. W. <st...@su...> - 2006-02-16 19:26:19
|
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 fields:
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).
'img' itself is a matrix of similar dimension as img['r'], but
contains the combined items of type '<f12'.
However, I would like to store the image as a 3xMxN array, with the r,
g and b bands being contained in
img[0], img[1] and img[2]
Is there a way to construct the record so that this structure is used
for storage? Further, how do I specify the dtype above, i.e.
N.dtype('<f12', [('r','<f4'),('g','<f4'),('b','<f4')])
in the style
N.dtype({'names' : ['r','g','b'], 'formats': ['f4','f4','f4']})
(how do I specify that the combined type is 'f12')?
I tried to find some documentation on record arrays, but couldn't find
anything. Any pointers appreciated!
Cheers
St=E9fan
|