class yt_astro_analysis.halo_analysis.halo_catalog.halo_catalog.HaloCatalog(halos_ds=None, data_ds=None, data_source=None, halo_field_type='all', finder_method=None, finder_kwargs=None, output_dir=None)

Create a HaloCatalog: an object that allows for the creation and association of data with a set of halo objects.

A HaloCatalog object pairs a simulation dataset and the output from a halo finder, allowing the user to perform analysis on each of the halos found by the halo finder. Analysis is performed by providing callbacks: functions that accept a Halo object and perform independent analysis, return a quantity to be associated with the halo, or return True or False whether a halo meets various criteria. The resulting set of quantities associated with each halo is then written out to disk at a “halo catalog.” This halo catalog can then be loaded in with yt as any other simulation dataset.

  • halos_ds (str) – Dataset created by a halo finder. If None, a halo finder should be provided with the finder_method keyword.

  • data_ds (str) – Dataset created by a simulation.

  • data_source (data container) – Data container associated with either the halos_ds to use for analysis. This can be used to restrict analysis to a subset of the full catalog. By default, the entire catalog will be analyzed.

  • halo_field_type (str) – The field type for halos. This can be used to specify a certain type of halo in a dataset that contains multiple types. Default: “all”

  • finder_method (str) – Halo finder to be used if no halos_ds is given.

  • output_dir (str) – The top level directory into which analysis output will be written. Default: “halo_catalogs”

  • finder_kwargs (dict) – Arguments to pass to the halo finder if finder_method is given.


>>> # create profiles or overdensity vs. radius for each halo and save to disk
>>> import yt
>>> from yt.extensions.astro_analysis.halo_analysis import HaloCatalog
>>> data_ds = yt.load("DD0064/DD0064")
>>> halos_ds = yt.load("rockstar_halos/halos_64.0.bin",
...                    output_dir="halo_catalogs/catalog_0064")
>>> hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)
>>> # filter out halos with mass < 1e13 Msun
>>> hc.add_filter("quantity_value", "particle_mass", ">", 1e13, "Msun")
>>> # create a sphere object with radius of 2 times the virial_radius field
>>> hc.add_callback("sphere", factor=2.0, radius_field="virial_radius")
>>> # make radial profiles
>>> hc.add_callback("profile", "radius", [("gas", "overdensity")],
...                 weight_field="cell_volume", accumulation=True)
>>> # save the profiles to disk
>>> hc.add_callback("save_profiles", output_dir="profiles")
>>> # create the catalog
>>> hc.create()
>>> # load in the saved halo catalog and all the profile data
>>> halos_ds = yt.load("halo_catalogs/catalog_0064/catalog_0064.0.h5")
>>> hc = HaloCatalog(halos_ds=halos_ds,
>>> hc.add_callback("load_profiles", output_dir="profiles")
>>> hc.load()

__init__([halos_ds, data_ds, data_source, ...])

add_callback(callback, *args, **kwargs)

Add a callback to the halo catalog action list.

add_filter(halo_filter, *args, **kwargs)

Add a filter to the halo catalog action list.

add_quantity(key, *args, **kwargs)

Add a quantity to the halo catalog action list.

add_recipe(recipe, *args, **kwargs)

Add a recipe to the halo catalog action list.

create([save_halos, save_output, njobs, dynamic])

Create the halo catalog given the callbacks, quantities, and filters that have been provided.


load([njobs, dynamic])

Load a previously created halo catalog.


partition_index_3d(ds[, padding, rank_ratio])


Returns an array that is used to drive _partition_index_3d_bisection, below.

partition_region_3d(left_edge, right_edge[, ...])

Given a region, it subdivides it into smaller regions for parallel analysis.