From: Uwe M. <uwe...@df...> - 2012-05-18 13:00:18
|
Hi, I have several leaf nodes of the same table dtype: class VideoNode(tables.IsDescription): ... Not all tables in the hdf5 file are of the same type, however. How do I iterate over all leafes which are tables of the above class, while ignoring tables with different signatures? i.e. I'd like to write something like: <code> f = tables.openFile(...) foo = f.walkNodes('/', classname='VideoNode') </code> which does not work because only the class name is "Table"... or <code> bar = filter(isinstance(x, VideoNode) for x in f.walkNodes('/', 'Table'))) </code> which does not work, because x is never an instance of VideoNode. Any ideas? Thanks in advance Uwe |
From: Anthony S. <sc...@gm...> - 2012-05-19 18:13:03
|
Hello Uwe, Why don't you try something like: bar = filter(x.description == VideoNode for x in f.walkNodes('/', 'Table')) or bar = filter(x.dtype == VideoNode._v_dtype for x in f.walkNodes('/', 'Table')) to compare the dtype / description directly? Be Well Anthony On May 18, 2012 8:00 AM, "Uwe Mayer" <uwe...@df...> wrote: > Hi, > > I have several leaf nodes of the same table dtype: > > class VideoNode(tables.IsDescription): > ... > > Not all tables in the hdf5 file are of the same type, however. How do I > iterate > over all leafes which are tables of the above class, while ignoring tables > with > different signatures? > > i.e. I'd like to write something like: > <code> > f = tables.openFile(...) > foo = f.walkNodes('/', classname='VideoNode') > </code> > which does not work because only the class name is "Table"... > > or > <code> > bar = filter(isinstance(x, VideoNode) for x in f.walkNodes('/', 'Table'))) > </code> > > which does not work, because x is never an instance of VideoNode. > > Any ideas? > > Thanks in advance > Uwe > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > |
From: Uwe M. <uwe...@df...> - 2012-05-21 08:15:04
|
Hi Anthony, On 05/19/2012 08:12 PM, Anthony Scopatz wrote: > Why don't you try something like: > > bar = filter(x.description == VideoNode for x in f.walkNodes('/', 'Table')) > > or > > bar = filter(x.dtype == VideoNode._v_dtype for x in f.walkNodes('/', > 'Table')) > > to compare the dtype / description directly? Oh. *g* This is exactly what I was looking for. I did not know how to use the class in a comparison for this. Thank you! Uwe > On May 18, 2012 8:00 AM, "Uwe Mayer" <uwe...@df... > <mailto:uwe...@df...>> wrote: > > Hi, > > I have several leaf nodes of the same table dtype: > > class VideoNode(tables.IsDescription): > ... > > Not all tables in the hdf5 file are of the same type, however. How > do I iterate > over all leafes which are tables of the above class, while ignoring > tables with > different signatures? > > i.e. I'd like to write something like: > <code> > f = tables.openFile(...) > foo = f.walkNodes('/', classname='VideoNode') > </code> > which does not work because only the class name is "Table"... > > or > <code> > bar = filter(isinstance(x, VideoNode) for x in f.walkNodes('/', > 'Table'))) > </code> > > which does not work, because x is never an instance of VideoNode. > > Any ideas? > > Thanks in advance > Uwe > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > <mailto:Pyt...@li...> > https://lists.sourceforge.net/lists/listinfo/pytables-users > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users |
From: Uwe M. <uwe...@df...> - 2012-05-21 11:20:50
|
Hi Anthony, On 05/19/2012 08:12 PM, Anthony Scopatz wrote: > Hello Uwe, > > Why don't you try something like: > > bar = filter(x.description == VideoNode for x in f.walkNodes('/', 'Table')) > > or > > bar = filter(x.dtype == VideoNode._v_dtype for x in f.walkNodes('/', > 'Table')) > > to compare the dtype / description directly? correction on my behalf, that would be exactly what I needed, but: - x.description compares false to a (correct) subclass of tables.IsDescription - a subclass of tables.IsDescription has no property _v_dtype to compare to x.dtype (from your example above) Any other ideas? Thanks in advance, Uwe > On May 18, 2012 8:00 AM, "Uwe Mayer" <uwe...@df... > <mailto:uwe...@df...>> wrote: > > Hi, > > I have several leaf nodes of the same table dtype: > > class VideoNode(tables.IsDescription): > ... > > Not all tables in the hdf5 file are of the same type, however. How > do I iterate > over all leafes which are tables of the above class, while ignoring > tables with > different signatures? > > i.e. I'd like to write something like: > <code> > f = tables.openFile(...) > foo = f.walkNodes('/', classname='VideoNode') > </code> > which does not work because only the class name is "Table"... > > or > <code> > bar = filter(isinstance(x, VideoNode) for x in f.walkNodes('/', > 'Table'))) > </code> > > which does not work, because x is never an instance of VideoNode. > > Any ideas? > > Thanks in advance > Uwe > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > <mailto:Pyt...@li...> > https://lists.sourceforge.net/lists/listinfo/pytables-users > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users |
From: Anthony S. <sc...@gm...> - 2012-05-21 14:34:41
|
Hi Uwe, Sorry, I wrote this when I was away from my computer and so I couldn't test it. Our documentation is clearly wrong then. However, what you *can* do is take the dtype from a known VideoNode table and then compare using this. known_dtype = f.root.path_to_a_video_node.dtype bar = filter(x.dtype == known_dtype for x in f.walkNodes('/', 'Table')) Note that in your file your file you could create an empty table with the VideoNode description at a specific location just so that you can read out this dtype. Be Well Anthony On Mon, May 21, 2012 at 6:20 AM, Uwe Mayer <uwe...@df...> wrote: > Hi Anthony, > > On 05/19/2012 08:12 PM, Anthony Scopatz wrote: > > Hello Uwe, > > > > Why don't you try something like: > > > > bar = filter(x.description == VideoNode for x in f.walkNodes('/', > 'Table')) > > > > or > > > > bar = filter(x.dtype == VideoNode._v_dtype for x in f.walkNodes('/', > > 'Table')) > > > > to compare the dtype / description directly? > > correction on my behalf, that would be exactly what I needed, but: > > - x.description compares false to a (correct) subclass of > tables.IsDescription > > - a subclass of tables.IsDescription has no property _v_dtype to compare > to x.dtype (from your example above) > > > Any other ideas? > > Thanks in advance, > Uwe > > > > On May 18, 2012 8:00 AM, "Uwe Mayer" <uwe...@df... > > <mailto:uwe...@df...>> wrote: > > > > Hi, > > > > I have several leaf nodes of the same table dtype: > > > > class VideoNode(tables.IsDescription): > > ... > > > > Not all tables in the hdf5 file are of the same type, however. How > > do I iterate > > over all leafes which are tables of the above class, while ignoring > > tables with > > different signatures? > > > > i.e. I'd like to write something like: > > <code> > > f = tables.openFile(...) > > foo = f.walkNodes('/', classname='VideoNode') > > </code> > > which does not work because only the class name is "Table"... > > > > or > > <code> > > bar = filter(isinstance(x, VideoNode) for x in f.walkNodes('/', > > 'Table'))) > > </code> > > > > which does not work, because x is never an instance of VideoNode. > > > > Any ideas? > > > > Thanks in advance > > Uwe > > > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. > > Discussions > > will include endpoint security, mobile security and the latest in > > malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Pytables-users mailing list > > Pyt...@li... > > <mailto:Pyt...@li...> > > https://lists.sourceforge.net/lists/listinfo/pytables-users > > > > > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > > > > > > _______________________________________________ > > Pytables-users mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/pytables-users > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > |