A Dijous 19 Gener 2006 18:19, Stefan Kuzminski va escriure:
> Thanks that works to get the flat array.  However I'm still trying to
> figure how to convert that RecArray to a normal 'all number' numarray.
> That might be a good 'flavor' of Table, i.e. not a RecArray but a
> regular numarray array for cases where the user is working with a
> homogeneous set of data types ( for example all Float ).  That
> optimizes the use case where the user wants to access rows of data as
> numarrays.

Uh. I'm not sure why do you use a Table object to keep homogeneous
data. Are you aware about the EArray object? It allows similar
functionality than Table, and it supports any kind of extended slicing
(bar negative steps). 

OTOH, you might be using special features of Table not present on
EArray (indexing, perhaps?). In this case, you can build your desired
object in a very efficient way by using the next trick:

In [32]: ra = numarray.records.array([[1,2],[3,4],[5,6]], formats='f4,f4', 
shape=3)

In [33]: ra.field('c2')
Out[33]: array([ 2.,  4.,  6.], type=Float32)

In [34]: ra.field('c1')
Out[34]: array([ 1.,  3.,  5.], type=Float32)

In [35]: numarray.array(ra._data, type='f4', shape=(len(ra),2))
Out[35]:
array([[ 1.,  2.],
       [ 3.,  4.],
       [ 5.,  6.]], type=Float32)

Cheers,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Pytables-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to