ytree.data_structures.tree_node.TreeNode

class ytree.data_structures.tree_node.TreeNode(uid, arbor=None, root=False)[source]

Class for objects stored in Arbors.

Each TreeNode represents a halo in a tree. A TreeNode knows its halo ID, the level in the tree, and its global ID in the Arbor that holds it. It also has a list of its ancestors. Fields can be queried for it, its progenitor list, and the tree beneath.

__init__(uid, arbor=None, root=False)[source]

Initialize a TreeNode with at least its halo catalog ID and its level in the tree.

Methods

__init__(uid[, arbor, root]) Initialize a TreeNode with at least its halo catalog ID and its level in the tree.
clear_fields() If a root node, delete field data.
find_root() Find the root node.
get_leaf_nodes([selector]) Get all leaf nodes from the tree of which this is the head.
get_node(selector, index) Get a single TreeNode from a tree.
get_root_nodes() Get all root nodes from the forest to which this node belongs.
query(key) Return field values for this TreeNode, progenitor list, or tree.
save_tree([filename, fields]) Save the tree to a file.
walk_to_root() Walk descendents until root.

Attributes

ancestors Return a generator of ancestor nodes.
desc_uids Array of descendent uids for all nodes in the tree.
descendent Return the descendent node.
is_root Is this node the last in the tree?
tree_id Return the index of this node in a list of all nodes in the tree.
tree_size Number of nodes in the tree.
uids Array of uids for all nodes in the tree.