It should be noted that the slice notation is waaaay faster than making a
new array.
For some random data I had lying around:
In [8]: timeit zzz = np.array(a.root.atomic_decay,
a.root.atomic_decay.dtype)
10 loops, best of 3: 144 ms per loop
In [11]: timeit zzz = a.root.atomic_decay[:]
10000 loops, best of 3: 129 us per loop
Be Well
Anthony
On Mon, Feb 20, 2012 at 11:25 AM, Francesc Alted <fal...@pytables.org>wrote:
> On Feb 20, 2012, at 6:15 PM, Ümit Seren wrote:
>
> > I guess using the slice operator on the table should probably also
> > load the entire table into memory:
> >
> > a = f.root.path.to.table[:]
>
> Much, much better :)
>
> > This will return a structured array tough.
>
> Yes, but nothing that cannot be solved:
>
> a = f.root.path.to.table[:].view(np.float32).reshape(-1, 4)
>
> Quick explanation:
>
> * Operator [:] reads out all the table and creates and structured array
> * Method `view(np.float32)` makes the data look like homogeneous float
> array
> * Method `reshape(-1, 4)` returns an homogeneous array with 4 columns.
>
> This does not require an additional data copy to obtain the homogeneous
> array.
>
> -- Francesc Alted
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users