On 10/31/12 4:30 AM, Andrea Gavana wrote:
> Thank you for all your suggestions. I managed to slightly modify the
> script you attached and I am also experimenting with compression.
> However, in the newly attached script the underlying table is not
> modified, i.e., this assignment:
>
> for p in table:
>      p['results'][:NUM_SIM, :, :] = numpy.random.random(size=(NUM_SIM,
> len(ALL_DATES), 7))
>      table.flush()

For modifying row values you need to assign a complete row object. 
Something like:

for i in range(len(table)):
     myrow = table[i]
     myrow['results'][:NUM_SIM, :, :] = 
numpy.random.random(size=(NUM_SIM, len(ALL_DATES), 7))
     table[i] = myrow

You may also use Table.modifyColumn() for better efficiency.  Look at 
the different modification methods here:

http://pytables.github.com/usersguide/libref/structured_storage.html#table-methods-writing

and experiment with them.

>
> Seems to be doing nothing (i.e., printing out the 'results' attribute
> for an object class prints a matrix full of zeros instead of random
> numbers...). Also, on my PC at work, the file creation time is
> tremendously slow (76 seconds for a 100 simulations - 1.9 GB file).
>
> In order to understand what's going on, I set back the number of
> simulations to 10 (NUM_SIM=10), but still I am getting only zeros out
> of the table. This is what my script is printing out:
>
> H5 file creation time: 7.652

Hmm, in my modest Core2 laptop I'm getting this:

H5 file creation time: 1.294

Also, by using compression with zlib level 1:

H5 file creation time: 1.900

And using blosc level 5:

H5 file creation time: 0.244

HTH,

-- 
Francesc Alted


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to