class ytree.arbor.tree_node_selector.TreeNodeSelector(function, args=None, kwargs=None)

The TreeNodeSelector is responsible for choosing which one of a halo’s ancestors to return when querying the line of main progenitors for a halo.

ancestors : list of TreeNode objects
List of TreeNode objects from which to select.

The function should return a single TreeNode.

>>> import ytree
>>> def max_value(ancestors, field):
...     vals = np.array([a[field] for a in ancestors])
...     return ancestors[np.argmax(vals)]
>>> ytree.add_tree_node_selector("max_field_value", max_value)
>>> a = ytree.load("tree_0_0_0.dat")
>>> a.set_selector("max_field_value", "mass")
>>> print (a[0]["prog"])
__init__(function, args=None, kwargs=None)

Initialize self. See help(type(self)) for accurate signature.


__init__(function[, args, kwargs]) Initialize self.