ytree.data_structures.tree_node.TreeNode.get_root_nodes¶
-
TreeNode.
get_root_nodes
()[source]¶ Get all root nodes from the forest to which this node belongs.
This returns a generator of all root nodes in the forest. A root node is a node that has no descendents.
Returns: root_nodes – TreeNode
objects.Return type: a generator of Examples
>>> import ytree >>> a = ytree.load("consistent_trees_hdf5/soa/forest.h5", ... access="forest") >>> my_tree = a[0] >>> for root in my_tree.get_root_nodes(): ... print (root["mass"])