Get a single TreeNode from a tree.
Use this to get the nth TreeNode from a forest, tree, or progenitor list for which the calling TreeNode is the head.
- selector (str ("forest", "tree", or "prog")) – The tree selector from which to get the TreeNode. This should be “forest”, “tree”, or “prog”.
- index (int) – The index of the desired TreeNode in the forest, tree, or progenitor list.
>>> import ytree >>> a = ytree.load("tiny_ctrees/locations.dat") >>> my_tree = a >>> # get 6th TreeNode in the progenitor list >>> my_node = my_tree.get_node('prog', 5)