Hi Andre', Il 25/06/2013 10:26, Andre' Walker-Loud ha scritto: > Dear PyTables users, > > I am trying to figure out the best way to write some metadata into some files > I have. > > The hdf5 file looks like > > /root/data_1/stat > /root/data_1/sys > > where "stat" and "sys" are Arrays containing statistical and systematic > fluctuations of numerical fits to some data I have. What I would like to do > is add another object > > /root/data_1/fit > > where "fit" is just a metadata key that describes all the choices I made in > performing the fit, such as seed for the random number generator, and many > choices for fitting options, like initial guess values of parameters, fitting > range, etc. > > I began to follow the example in the PyTables manual, in Section 1.2 "The > Object Tree", where first a class is defined > > class Particle(tables.IsDescription): > identity = tables.StringCol(itemsize=22, dflt=" ", pos=0) > ... > > and then this class is used to populate a table. > > In my case, I won't have a table, but really just want a single object > containing my metadata. I am wondering if there is a recommended way to do > this? The "Table" does not seem optimal, but I don't see what else I would > use. > > > Thanks, > > Andre >
For leaf nodes (Tables, Array, ets) you can use the "attrs" attribute set [1] as described in [2]. For group objects (like e.g. "root") you can use the "set_node_attr" method [3] of File objects or "_v_attrs". cheers [1] http://pytables.github.io/usersguide/libref/declarative_classes.html#attributesetclassdescr [2] http://pytables.github.io/usersguide/tutorials.html#setting-and-getting-user-attributes [3] http://pytables.github.io/usersguide/libref/file_class.html#tables.File.set_node_attr -- Antonio Valentino ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users