add_halo_hostid

halotools.utils.add_halo_hostid(table, delete_possibly_existing_column=False)[source]

Function creates a new column halo_hostid for the input table. For rows with halo_upid = -1, halo_hostid = halo_id. Otherwise, halo_hostid = halo_upid.

Parameters:
tableAstropy Table

Table storing the halo catalog.

delete_possibly_existing_columnbool, optional

If set to False, add_halo_hostid will raise an Exception if the input table already contains a halo_hostid column. If True, the column will be deleted if it exists, and no action will be taken if it does not exist. Default is False.

Examples

>>> from halotools.sim_manager import FakeSim
>>> halocat = FakeSim()
>>> del halocat.halo_table['halo_hostid']
>>> add_halo_hostid(halocat.halo_table)