ytree


Nameytree JSON
Version 3.3.0 PyPI version JSON
download
home_pageNone
SummaryAn extension of yt for working with merger tree data.
upload_time2025-08-21 15:39:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords simulation merger tree astronomy astrophysics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ytree

[![CircleCI](https://circleci.com/gh/ytree-project/ytree/tree/main.svg?style=svg)](https://circleci.com/gh/ytree-project/ytree/tree/main)
[![codecov](https://codecov.io/gh/ytree-project/ytree/branch/main/graph/badge.svg)](https://codecov.io/gh/ytree-project/ytree)
[![Documentation Status](https://readthedocs.org/projects/ytree/badge/?version=latest)](http://ytree.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/ytree.svg)](https://badge.fury.io/py/ytree)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/ytree/badges/version.svg)](https://anaconda.org/conda-forge/ytree)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.01881/status.svg)](https://doi.org/10.21105/joss.01881)
[![yt-project](https://img.shields.io/static/v1?label="works%20with"&message="yt"&color="blueviolet")](https://yt-project.org)

This is `ytree`, a [yt](https://github.com/yt-project/yt) extension for
working with tree data and especially merger trees.

Generally speaking, tree data defines a one-directional relationship
between a series of objects. In trees, objects can have one or more
ancestors, but only a single descendent.

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. `ytree` is Python
package for reading and working with merger tree data from multiple
formats. If you are already familiar with using
[yt](https://github.com/yt-project/yt) to analyze snapshots from
cosmological simulations, then think of `ytree` as the `yt` of merger
trees.

To load a merger tree data set with `ytree` and 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] Msun
```

A list of all currently supported formats can be found in the online
[documentation](https://ytree.readthedocs.io/en/latest/Arbor.html#loading-merger-tree-data). 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.

## Installation

`ytree` can be installed with pip or conda:

### pip installation

```
pip install ytree
```

### conda installation

```
conda install -c conda-forge ytree
```

### source installation

To 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 Started

The [ytree documentation](https://ytree.readthedocs.io) will walk you
through installation, get you started analyzing merger trees, and help
you become a contributor to the project. Have a look!

## Sample Data

Sample data for all merger tree formats supported by `ytree` is available on the
[yt Hub](https://girder.hub.yt/) in the
[ytree data](https://girder.hub.yt/#collection/59835a1ee2a67400016a2cda) collection.

## Contributing

`ytree` would be much better with your contribution!  As an extension of
[the yt Project](https://yt-project.org/), we follow the yt
[guidelines for contributing](https://github.com/yt-project/yt#contributing).

## Citing `ytree`

If you use `ytree` in 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.01881
```

For 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 of `ytree` used in
your work, include the following reference:

```
  @software{britton_smith_2023_8349044,
    author       = {Britton Smith and
                    Meagan Lang and
                    John Wise and
                    Juanjo Bazán},
    title        = {ytree-project/ytree: ytree 3.2.1 Release},
    month        = sep,
    year         = 2023,
    publisher    = {Zenodo},
    version      = {ytree-3.2.1},
    doi          = {10.5281/zenodo.8349044},
    url          = {https://doi.org/10.5281/zenodo.8349044}
  }
```

## Resources

 * The latest documentation can be found at
   https://ytree.readthedocs.io.

 * The [ytree
   paper](https://joss.theoj.org/papers/10.21105/joss.01881) in the
   [Journal of Open Source Software](https://joss.theoj.org/).

 * `ytree` is an extension of [the yt
   Project](https://yt-project.org/). The [yt-project community
   resources](https://github.com/yt-project/yt#resources) can be used
   for ytree-related communication. The `ytree` developers can usually
   be found on the yt project Slack channel.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ytree",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "simulation, merger tree, astronomy, astrophysics",
    "author": null,
    "author_email": "Britton Smith <brittonsmith@gmail.clm>",
    "download_url": "https://files.pythonhosted.org/packages/74/63/833e2157a973f114e8ef1f12e2839d392c0a18e1df81983ffa4be70b77c9/ytree-3.3.0.tar.gz",
    "platform": null,
    "description": "# ytree\n\n[![CircleCI](https://circleci.com/gh/ytree-project/ytree/tree/main.svg?style=svg)](https://circleci.com/gh/ytree-project/ytree/tree/main)\n[![codecov](https://codecov.io/gh/ytree-project/ytree/branch/main/graph/badge.svg)](https://codecov.io/gh/ytree-project/ytree)\n[![Documentation Status](https://readthedocs.org/projects/ytree/badge/?version=latest)](http://ytree.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/ytree.svg)](https://badge.fury.io/py/ytree)\n[![Anaconda-Server Badge](https://anaconda.org/conda-forge/ytree/badges/version.svg)](https://anaconda.org/conda-forge/ytree)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.01881/status.svg)](https://doi.org/10.21105/joss.01881)\n[![yt-project](https://img.shields.io/static/v1?label=\"works%20with\"&message=\"yt\"&color=\"blueviolet\")](https://yt-project.org)\n\nThis is `ytree`, a [yt](https://github.com/yt-project/yt) extension for\nworking with tree data and especially merger trees.\n\nGenerally speaking, tree data defines a one-directional relationship\nbetween a series of objects. In trees, objects can have one or more\nancestors, but only a single descendent.\n\nStructure formation in cosmology proceeds in a hierarchical fashion,\nwhere dark matter halos grow via mergers with other halos. This type\nof evolution can be conceptualized as a tree, with small branches\nconnecting to successively larger ones, and finally to the trunk. A\nmerger tree describes the growth of halos in a cosmological\nsimulation by linking a halo appearing in a given snapshot to its\ndirect ancestors in a previous snapshot and its descendent in the next\nsnapshot.\n\nMerger trees are computationally expensive to generate and a great\nnumber of codes exist for computing them. However, each of these codes\nsaves the resulting data to a different format. `ytree` is Python\npackage for reading and working with merger tree data from multiple\nformats. If you are already familiar with using\n[yt](https://github.com/yt-project/yt) to analyze snapshots from\ncosmological simulations, then think of `ytree` as the `yt` of merger\ntrees.\n\nTo load a merger tree data set with `ytree` and print the masses of\nall the halos in a single tree, one could do:\n\n```\n>>> import ytree\n>>> a = ytree.load('tree_0_0_0.dat')\n>>> my_tree = a[0]\n>>> print(my_tree['tree', 'mass'].to('Msun'))\n[6.57410072e+14 6.57410072e+14 6.53956835e+14 6.50071942e+14 ...\n 2.60575540e+12 2.17122302e+12 2.17122302e+12] Msun\n```\n\nA list of all currently supported formats can be found in the online\n[documentation](https://ytree.readthedocs.io/en/latest/Arbor.html#loading-merger-tree-data). If\nyou would like to see support added for another format, we would be\nhappy to work with you to make it happen. In principle, any type of\ntree-like data where an object has one or more ancestors and a single\ndescendent can be supported.\n\n## Installation\n\n`ytree` can be installed with pip or conda:\n\n### pip installation\n\n```\npip install ytree\n```\n\n### conda installation\n\n```\nconda install -c conda-forge ytree\n```\n\n### source installation\n\nTo get the development version, clone this repository and install like this:\n\n```\ngit clone https://github.com/ytree-project/ytree\ncd ytree\npip install -e .\n```\n\n## Getting Started\n\nThe [ytree documentation](https://ytree.readthedocs.io) will walk you\nthrough installation, get you started analyzing merger trees, and help\nyou become a contributor to the project. Have a look!\n\n## Sample Data\n\nSample data for all merger tree formats supported by `ytree` is available on the\n[yt Hub](https://girder.hub.yt/) in the\n[ytree data](https://girder.hub.yt/#collection/59835a1ee2a67400016a2cda) collection.\n\n## Contributing\n\n`ytree` would be much better with your contribution!  As an extension of\n[the yt Project](https://yt-project.org/), we follow the yt\n[guidelines for contributing](https://github.com/yt-project/yt#contributing).\n\n## Citing `ytree`\n\nIf you use `ytree` in your work, please cite the following:\n\n```\nSmith et al., (2019). ytree: A Python package for analyzing merger trees.\nJournal of Open Source Software, 4(44), 1881,\nhttps://doi.org/10.21105/joss.01881\n```\n\nFor BibTeX users:\n\n```\n  @article{ytree,\n    doi = {10.21105/joss.01881},\n    url = {https://doi.org/10.21105/joss.01881},\n    year  = {2019},\n    month = {dec},\n    publisher = {The Open Journal},\n    volume = {4},\n    number = {44},\n    pages = {1881},\n    author = {Britton D. Smith and Meagan Lang},\n    title = {ytree: A Python package for analyzing merger trees},\n    journal = {Journal of Open Source Software}\n  }\n```\n\nIf you would like to also cite the specific version of `ytree` used in\nyour work, include the following reference:\n\n```\n  @software{britton_smith_2023_8349044,\n    author       = {Britton Smith and\n                    Meagan Lang and\n                    John Wise and\n                    Juanjo Baz\u00e1n},\n    title        = {ytree-project/ytree: ytree 3.2.1 Release},\n    month        = sep,\n    year         = 2023,\n    publisher    = {Zenodo},\n    version      = {ytree-3.2.1},\n    doi          = {10.5281/zenodo.8349044},\n    url          = {https://doi.org/10.5281/zenodo.8349044}\n  }\n```\n\n## Resources\n\n * The latest documentation can be found at\n   https://ytree.readthedocs.io.\n\n * The [ytree\n   paper](https://joss.theoj.org/papers/10.21105/joss.01881) in the\n   [Journal of Open Source Software](https://joss.theoj.org/).\n\n * `ytree` is an extension of [the yt\n   Project](https://yt-project.org/). The [yt-project community\n   resources](https://github.com/yt-project/yt#resources) can be used\n   for ytree-related communication. The `ytree` developers can usually\n   be found on the yt project Slack channel.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An extension of yt for working with merger tree data.",
    "version": "3.3.0",
    "project_urls": {
        "Changelog": "https://ytree.readthedocs.io/en/latest/Changelog.html",
        "Documentation": "https://ytree.readthedocs.io/en/stable/index.html",
        "Homepage": "https://github.com/ytree-project/ytree",
        "Issues": "https://github.com/ytree-project/ytree/issues",
        "Repository": "https://github.com/ytree-project/ytree"
    },
    "split_keywords": [
        "simulation",
        " merger tree",
        " astronomy",
        " astrophysics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c9eb2f787433d045fd4d66678e8a2c37b027db11c991cda5b5cbffabd714d35b",
                "md5": "92bd9be2edc3e1041afd41f25962cf4a",
                "sha256": "bba1cae69baf25e091a8a92926080145b9b3718e2790fbdf436256bcac0c2e36"
            },
            "downloads": -1,
            "filename": "ytree-3.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92bd9be2edc3e1041afd41f25962cf4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 140751,
            "upload_time": "2025-08-21T15:39:24",
            "upload_time_iso_8601": "2025-08-21T15:39:24.412966Z",
            "url": "https://files.pythonhosted.org/packages/c9/eb/2f787433d045fd4d66678e8a2c37b027db11c991cda5b5cbffabd714d35b/ytree-3.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7463833e2157a973f114e8ef1f12e2839d392c0a18e1df81983ffa4be70b77c9",
                "md5": "e6ce6c063b1a465248f0b9e234d01905",
                "sha256": "be863e5d68718f9e8ee6942e810e7f954cdbac2080268f7064e73cf1e5a52870"
            },
            "downloads": -1,
            "filename": "ytree-3.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e6ce6c063b1a465248f0b9e234d01905",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 846517,
            "upload_time": "2025-08-21T15:39:25",
            "upload_time_iso_8601": "2025-08-21T15:39:25.820325Z",
            "url": "https://files.pythonhosted.org/packages/74/63/833e2157a973f114e8ef1f12e2839d392c0a18e1df81983ffa4be70b77c9/ytree-3.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 15:39:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ytree-project",
    "github_project": "ytree",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "lcname": "ytree"
}
        
Elapsed time: 3.39723s