yt_astro_analysis.halo_analysis.halo_catalog.halo_catalog.HaloCatalog.add_quantity

HaloCatalog.add_quantity(key, *args, **kwargs)

Add a quantity to the halo catalog action list.

A quantity is a function that accepts a Halo object and return a value or values. These values are stored in a “quantities” dictionary associated with the Halo object. Quantities must exist within the quantity_registry. Give additional args and kwargs to be passed to the quantity function here.

Parameters:
  • key (string) – The name of the callback.

  • field_type (string) – If not None, the quantity is the value of the field provided by the key parameter, taken from the halo finder dataset. This is the way one pulls values for the halo from the halo dataset. Default : None

Examples

>>> # pull the virial radius from the halo finder dataset
>>> hc.add_quantity("virial_radius", field_type="halos")
>>> # define a custom quantity and add it to the register
>>> def _mass_squared(halo):
...     # assume some entry "particle_mass" exists in the quantities dict
...     return halo.quantities["particle_mass"]**2
>>> add_quantity("mass_squared", _mass_squared)
>>> # add it to the halo catalog action list
>>> hc.add_quantity("mass_squared")