A Friday 26 September 2008, filc ekab escrigué: > I have a numpy flavor Array in an HDF5 file. I would like to > access an ndarray object representing the array and do > something like, x[1,2] = 3, and have that change reflected > in the file. I want to use the ndarray methods to get numpy > to reinterpret the format of the data before I access it. > I am not sure how to do it. I can use Array.read() to get > an ndarray object, but it appears that is a copy of the data, > and does not provide me direct access to bytes in the file. > I want to be able to access large (gigabytes) arrays of bytes, > so I do not want to read the whole thing, then write the > whole thing back. I realize of course that the Array class > provides __getitem__ and __setitem__ style access, but I > need to tell the ndarray object the layout of the data.
I don't think you can do what you want with PyTables because there is the HDF5 layer in-between NumPy and the data on-disk. If you want to transparently manage on-disk data as if it was in-memory, you may want to try memory-mapped arrays. See section 8.3 of the NumPy book available at: http://www.tramy.us/numpybook.pdf Out of curiosity, may you be a bit more explicit on what you are after? Perhaps a code snippet would help us to better understand your need and suggest anything more specific. Cheers, -- Francesc Alted Freelance developer Tel +34-964-282-249 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users