Francesc Altet wrote:
> A Monday 24 September 2007, Michael Hoffman escrigué:
>> Francesc Altet wrote:
>>> A Monday 24 September 2007, Francesc Altet escrigué:
>>>> A Monday 24 September 2007, Michael Hoffman escrigué:
>>>>> Perhaps it would still take the same time over the whole file,
>>>>> but I think that by doing a depth-first search I can get to the
>>>>> first Leaf more quickly.
>>>>>
>>>>> This is important in two scenarios. First, sometimes I just need
>>>>> to get a single array, and it doesn't matter which one. Secondly,
>>>>> it is more reassuring to users (and even myself) to be able to
>>>>> print progress reports as the file is loading.
>>>> Mmm, I don't know if I understand you well, but perhaps using a
>>>> combination of File.getNode and File.{iterNodes, listNodes} (or
>>>> its Group.{_f_iterNodes, _f_iterNodes} counterparts) could help
>>>> you avoid reinventing the wheel?
>> Thanks for the suggestion. This is what I ended up doing:
>>
>> def walk_nodes(h5file, classname="Array"):
>> for group in h5file.root._v_groups.itervalues():
>> for node in group._f_walkNodes(classname):
>> yield node
>
> Aha! I understand you better now. As always, code is the best tool to
> communicate ideas (at least in computer sciences ;-)
>
> I've filed a ticket (http://www.pytables.org/trac/ticket/114) about this
> so that we don't forget considering to implement your suggestion for a
> future version of PyTables.
Thanks. Obviously my version is biased towards my particular data
structure which is always root/group/array, but a more general function
should certainly be possible.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users