A Dimecres 13 Desembre 2006 23:27, Curious Jan escrigué: > Actually, I just found the problem. > Apparently, changing the table type from numpy to numarray fixes the > problem. > So it appears that I just encountered the problem because I was trying to > run a quick test over a subsample, which I got from a slicing operation. > And it looks like the result of that slicing operation differs depending on > the type of the table (numpy vs. numarray). > Ah, heck, I don't need slicing, so I'll just keep iterating over the whole > tree.
Yeah. The problem was that 'x' was a 'numpy' recarray, and not a 'nestedrecarray' (a PyTables' object descendant from a numarray recarray object). In 'nestedrecarray' flavor, the way to access nested records is x['Baryon1/Gamma'], but for numpy recarrays you sould use the idiom x['Baryon1']['Gamma'] instead. In PyTables 2.x, the numpy idiom should be documented as it will become the default way to access nested fields. It's nice that you brought this to our attention. Cheers, > > On 12/13/06, Curious Jan <[EMAIL PROTECTED]> wrote: > > Hi list, > > > > I'm trying to model a high-energy physics event in pytables and have been > > reasonably successful so far. > > However, I just changed the structure of my nested tables, and now I > > can't access the columns by name anymore. > > I try the following: > > > > from tables import openFile > > fh = openFile('bug.h5') > > x = fh.root.bug[0] > > print x['Baryon1'] > > print x['Baryon1/Gamma'] # doesn't work > > y = x['Baryon1'] > > print y['Gamma'] # works > > > > I find this very, very strange, and would appreciate comments/suggestion. > > Regards, > > Jan -- >0,0< Francesc Altet http://www.carabos.com/ V V Cárabos Coop. V. Enjoy Data "-" ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users