yt.analysis_modules.halo_analysis.halo_catalog.HaloCatalog

class yt.analysis_modules.halo_analysis.halo_catalog.HaloCatalog(halos_ds=None, data_ds=None, data_source=None, finder_method=None, finder_kwargs=None, output_dir='halo_catalogs/catalog')[source]

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.

Parameters:

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 or the data_ds.

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: ”.”

finder_kwargs : dict

Arguments to pass to the halo finder if finder_method is given.

See also

add_callback, add_filter, add_finding_method, add_quantity

Examples

>>> # create profiles or overdensity vs. radius for each halo and save to disk
>>> from yt.mods import *
>>> from yt.analysis_modules.halo_analysis.api import *
>>> data_ds = load("DD0064/DD0064")
>>> halos_ds = 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 = load("halo_catalogs/catalog_0064/catalog_0064.0.h5")
>>> hc = HaloCatalog(halos_ds=halos_ds,
                     output_dir="halo_catalogs/catalog_0064")
>>> hc.add_callback("load_profiles", output_dir="profiles")
>>> hc.load()

Attributes

Methods