Gaetan de Menten :
> On Fri, Oct 22, 2010 at 10:53, Francesc Alted <fal...@pytables.org> wrote:
>   
>> A Friday 22 October 2010 10:45:13 Francesc Alted escrigué:
>>     
>>> A Friday 22 October 2010 10:19:50 Gaetan de Menten escrigué:
>>>       
>>>> Hello,
>>>>
>>>> I guess you are pretty busy, but I would really appreciate your
>>>> opinion about those two tickets (it's been 3 months without reply).
>>>> I'm willing to make (other) patches, tests or whatever you want to
>>>> get those changes included. Especially 287 is a burden for me since
>>>> I have to distribute my patch along with my program and explain to
>>>> my users how to patch their copy of PyTables... So I would like for
>>>> it to be either included in some form, or rejected altogether so
>>>> that I would work around it.
>>>>         
>>> Yeah, too many things to do lately...  Anyway, I plan to release
>>> 2.2.1 next week (let's see).  I've had a quick look into #287 and
>>> seems good to me, so I plan to add it to the forthcoming release.
>>> Which is the other you are referring to?
>>>       
>> Er... you are referring to #286 indeed.  I'll try to think about this
>> (of course, a patch would help me think faster :-)
>>     
>
> Thanks for the quick reply. I'll produce a patch for #286... in time.
> That one is more a nitpick than anything, so I'll come back to it in a
> few weeks now that I know you are possibly interested...
>
>   
Hi Gaëtan,

I am just about to ask for the similar feature. Without this feature, I 
have to recreate the Expr object every time I try to change the start 
and end position, which is very annoying, although it will not affect 
the performance a lot. And the eval() can only be called once, other 
wise it is going to give wrong result.

I try to create an expr object with certain expression, then I am going 
to change the input range in a loop, and repeatedly call expr.eval().
I found out this is impossible, only the first time calling expr.eval() 
will work, outputing (10,5) array. Then it always ouputs the same (5,) 
array, unless I recreate expr again. Is this an expected behavior?

By the way, is there any way to set the input range for several 
different dimensions? For example, if I get (4e12,100) array: A, and I 
probably want to evaluate expression only on A[x:y,2:5]. I think 
this will be very useful feature for large arrays.

############
import numpy as npy
import tables as pytbs
import time
shape=(4e6,5)
atom=pytbs.Float64Atom()
h5file = pytbs.openFile(h5filename, mode = "w")
ca = h5file.createCArray(\
    h5file.root,'tryArray',\
    atom,shape,\
    chunkshape=(1024*512/8,5))
for i in range(0,10):
    print i
    ca[i*4e5:(i+1)*4e5,:]=npy.random.rand(4e5,5)
h5file.close()

h5file=pytbs.openFile(h5filename,mode='r')
srcArray=h5file.root.tryArray
expr = pytbs.Expr("10*srcArray")

for i in range(0,5):
    a1_st=npy.random.randint(0,2e6-1)
    print 'start:',a1_st
    expr.setInputsRange(start=long(a1_st),stop=long(a1_st+10))
    print 'start,stop:',expr.start, expr.stop
    print expr.eval()
    print '******\r\n',10*scrArray[a1_st:(a1_st+10),:]
####

LittleBigBrain

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to