HaloCatalog.
add_quantity
(key, *args, **kwargs)[source]¶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
field_type : string
|
---|
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")