API Reference

Working with Merger-Trees

The ~ytree.arbor.load can load all supported merger-tree formats. Once loaded, the ~ytree.arbor.Arbor.save_arbor and ~ytree.tree_node.TreeNode.save_tree functions can be used to save the entire arbor or individual trees.

load(filename[, method]) Load an Arbor, determine the type automatically.
save_arbor([filename, fields]) Save the arbor to a file.
save_tree([filename, fields]) Save the tree to a file.
_line(field) Return a requested field for all TreeNodes in the line, starting with this TreeNode.
_tree(field) Return a requested field for all TreeNodes in the tree beneath, starting with this TreeNode.
set_selector(selector, *args, **kwargs) Sets the tree node selector to be used.
TreeNodeSelector(function[, args, kwargs]) A TreeNodeSelector is responsible for choosing which one of a halo’s ancestors to return for accessing fields from trees with the ~ytree.tree_node.TreeNode._line function.
add_tree_node_selector(name, function) Add a TreeNodeSelector to the registry of known selectors, so they can be chosen with ~ytree.arbor.Arbor.set_selector.
max_field_value(ancestors, field) Return the TreeNode with the maximum value of the given field.
min_field_value(ancestors, field) Return the TreeNode with the minimum value of the given field.

Making Merger-Trees

TreeFarm(time_series[, setup_function]) TreeFarm is the merger-tree creator for Gadget FoF and Subfind halo catalogs.
trace_ancestors(halo_type, root_ids[, ...]) Trace the ancestry of a given set of halos.
trace_descendents(halo_type[, fields, filename]) Trace the descendents of all halos.
set_selector(selector, *args, **kwargs) Set the method for selecting candidate halos for tracing halo ancestry.
set_ancestry_checker(ancestry_checker, ...) Set the method for determing if a halo is the ancestor of another halo.
set_ancestry_filter(ancestry_filter, *args, ...) Select a method for determining which ancestors are kept.
set_ancestry_short(ancestry_short, *args, ...) Select a method for cutting short the ancestry search.
AncestryChecker(function[, args, kwargs]) An AncestryCheck is a function that is responsible for determining whether one halo is an ancestor of another.
add_ancestry_checker(name, function)
common_ids(descendent_ids, ancestor_ids[, ...]) Determine if at least a given fraction of ancestor’s member particles are in the descendent.
AncestryFilter(function[, args, kwargs]) An AncestryFilter takes a halo and a list of ancestors and returns a filtered list of filtered list of ancestors.
add_ancestry_filter(name, function)
most_massive(halo, ancestors) Return only the most massive ancestor.
AncestryShort(function[, args, kwargs]) An AncestryShort takes a halo and an ancestor halo and determines if the ancestry search should come to an end.
add_ancestry_short(name, function)
above_mass_fraction(halo, ancestor, fraction) Return only the most massive ancestor.
HaloSelector(function[, args, kwargs]) A HaloSelector is a function that is responsible for creating a list of ids of halos that are potentially ancestors of a given halo.
add_halo_selector(name, function) Add a HaloSelector to the registry of known selectors, so they can be chosen with ~ytree.tree_farm.TreeFarm.set_selector.
sphere_selector(hc, ds2, radius_field[, ...]) Select halos within a sphere around the target halo.
all_selector(hc, ds2) Return all halos from the ancestor dataset.

Internal Classes

Arbor(filename) Base class for all Arbor classes.
ArborArbor(filename) Class for Arbors created from the save_arbor or save_tree functions.
CatalogArbor(filename) Base class for Arbors created from a series of halo catalog files where the descendent ID for each halo has been pre-determined.
ConsistentTreesArbor(filename) Class for Arbors from consistent-trees output files.
MonolithArbor(filename) Base class for Arbors loaded from a single file.
RockstarArbor(filename) Class for Arbors created from Rockstar out_*.list files.
TreeFarmArbor(filename) Class for Arbors created with TreeFarm.
TreeNode(halo_id, level_id[, global_id, arbor]) Class for objects stored in Arbors.