ytree.frontends.ytree.arbor.YTreeArbor.get_nodes_from_selection

YTreeArbor.get_nodes_from_selection(container)[source]

Generate TreeNodes from a yt data container.

All halos contained within the data container will be returned as TreeNode objects. This returns a generator that can be iterated over or cast as a list.

Parameters:container (YTDataContainer) – Data container, such as a sphere or region, from which nodes will be generated.
Returns:nodes – The TreeNode objects contained within the container.
Return type:generator

Examples

>>> import ytree
>>> a = ytree.load("arbor/arbor.h5")
>>> c = a.arr([0.5, 0.5, 0.5], "unitary")
>>> sphere = a.ytds.sphere(c, (0.1, "unitary"))
>>> for node in a.get_nodes_from_selection(sphere):
...     print (node["mass"])
>>> import ytree
>>> a = ytree.load("arbor/arbor.h5")
>>> # select halos above 1e12 Msun at redshift > 0.5
>>> sel = a.get_yt_selection(
...     above=[("mass", 1e13, "Msun"),
...            ("redshift", 0.5)])
>>> my_nodes = list(a.get_nodes_from_selection(sel))