Hi Francesc,

Thanks for you answers. 

> Yes, just try loading data in chunks.  For example, let's say that your 
> array is bidimensional; I think something like should work:
> 
> carray = tables.createCArray(...)
> for i,row in enumerate(your_memmap_array):
>    carray[i] = row
> 
> Maybe using EArrays would be slightly simpler:
> 
> earray = tables.createEArray(...)
> for i,row in your_memmap_array:
>    earray.append(row)
> 
> For other dimensions you have to find an appropriate chunk, but the 
> example above illustrates the idea.

Is there a way to iterate over chunks, or should I just check chunkshape and 
adjust indices appropriately?

> 
>> 2) In the data I want to find threshold crossings. In numpy I usually
>> do it using nonzero function:
>> 
>> import numpy as np
>> a = np.random.randn(100)
>> T = 0
>> i, = np.nonzero((a[:-1]<T) & (a[1:]>T))
>> 
>> How can I implement it with tables.Expr?
> 
> You can't.  tables.Expr only support expressions as in numexpr, and 
> unfortunately, this does not include indexing variables in the middle of 
> expressions (as in your example).

Right. I think that I could avoid indexing by using something like this:

i, = np.nonzero(a>T)

which returns a list of indices. Since this list should be much shorter than 
"a", I could use fancy indexing in numpy to extract the threshold crossings 
from "i":

j, = np.nonzero(np.diff(i)>1)
crossings = i[j]

However, in order to do that one needs nonzero function in tables.Expr. Is it 
possible to implement it?

Another, simpler solution combines nonzero, diff function and type conversion 
in tables.Expr expression like this:

crossing, = np.nonzero(np.diff((a>T)*1)>0)

Would it be possible to implement it either way?

Yours,

Bartosz
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to