Package: ytree
ytreeThis isytree, aytextension for
working with merger tree data.Structure formation in cosmology proceeds in a hierarchical fashion,
where dark matter halos grow via mergers with other halos. This type
of evolution can be conceptualized as a tree, with small branches
connecting to successively larger ones, and finally to the trunk. A
merger tree describes the growth of halos in a cosmological
simulation by linking a halo appearing in a given snapshot to its
direct ancestors in a previous snapshot and its descendent in the next
snapshot.Merger trees are computationally expensive to generate and a great
number of codes exist for computing them. However, each of these codes
saves the resulting data to a different format.ytreeis Python
package for reading and working with merger tree data from multiple
formats. If you are already familiar with usingytto analyze snapshots from
cosmological simulations, then think ofytreeas theytof merger
trees.To load a merger tree data set withytreeand print the masses of
all the halos in a single tree, one could do:>>> import ytree
>>> a = ytree.load('tree_0_0_0.dat')
>>> my_tree = a[0]
>>> print(my_tree['tree', 'mass'].to('Msun'))
[6.57410072e+14 6.57410072e+14 6.53956835e+14 6.50071942e+14 ...
 2.60575540e+12 2.17122302e+12 2.17122302e+12] MsunA list of all currently supported formats can be found in the onlinedocumentation. If
you would like to see support added for another format, we would be
happy to work with you to make it happen. In principle, any type of
tree-like data where an object has one or more ancestors and a single
descendent can be supported.Installationytreecan be installed with pip or conda:pip installationpip install ytreeconda installationconda install -c conda-forge ytreesource installationTo get the development version, clone this repository and install like this:git clone https://github.com/ytree-project/ytree
cd ytree
pip install -e .Getting StartedTheytree documentationwill walk you
through installation, get you started analyzing merger trees, and help
you become a contributor to the project. Have a look!Sample DataSample data for all merger tree formats supported byytreeis available on theyt Hubin theytree datacollection.Contributingytreewould be much better with your contribution!  As an extension ofthe yt Project, we follow the ytguidelines for contributing.CitingytreeIf you useytreein your work, please cite the following:Smith et al., (2019). ytree: A Python package for analyzing merger trees.
Journal of Open Source Software, 4(44), 1881,
https://doi.org/10.21105/joss.01881For BibTeX users:@article{ytree,
    doi = {10.21105/joss.01881},
    url = {https://doi.org/10.21105/joss.01881},
    year  = {2019},
    month = {dec},
    publisher = {The Open Journal},
    volume = {4},
    number = {44},
    pages = {1881},
    author = {Britton D. Smith and Meagan Lang},
    title = {ytree: A Python package for analyzing merger trees},
    journal = {Journal of Open Source Software}
  }If you would like to also cite the specific version ofytreeused in
your work, include the following reference:@software{britton_smith_2022_7335683,
  author       = {Britton Smith and
                  Meagan Lang and
                  Juanjo Bazán},
  title        = {ytree-project/ytree: ytree 3.2.0 Release},
  month        = nov,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {ytree-3.2.0},
  doi          = {10.5281/zenodo.7335683},
  url          = {https://doi.org/10.5281/zenodo.7335683}
}ResourcesThe latest documentation can be found athttps://ytree.readthedocs.io.Theytree
paperin theJournal of Open Source Software.ytreeis an extension ofthe yt
Project. Theyt-project community
resourcescan be used
for ytree-related communication. Theytreedevelopers can usually
be found on the yt project Slack channel.