A Dijous 12 Juliol 2007 05:29, Eric Jonas escrigué: > I've got a hdf5 data file with nested compound types, which I can > correctly read with ptdump and h5dump, but for which I get two different > answers for the "src" field : > > #!/usr/bin/python > import tables > print "version is ", tables.__version__ > > t = tables.openFile('tspikeappend.h5') > table = t.root.testGroup.chan23 > print "method 1:" > for i in range(len(table)): > print table[i]['src'] > > print "method 2:" > for i in table.iterrows(): > print i['src'] > > > Generates: > > [EMAIL PROTECTED] unittest]$ python test.py > version is 2.0 > method 1: > 23 > 23 > 23 > 23 > method 2: > 23 > 0 > 0 > 0 > > The file is at > > http://web.mit.edu/jonas/Public/tspikeappend.h5 > > This is from the latest 2.0 tarball on the website, with numpy from svn.
I've looked into this and it is apparently an alignment issue in nested records created with other tools than PyTables. Despite that PyTables already has machinery for dealing with different alignments, it seems that it is not sophisticated enough for dealing with all cases, most specially nested records. Perhaps you could try creating a contiguous nested record by removing all the alignment in fields (this is the way PyTables creates the tables on-disk). HTH, -- >0,0< Francesc Altet http://www.carabos.com/ V V Cárabos Coop. V. Enjoy Data "-" ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users