acm.hod#

acm.hod.box#

class acm.hod.box.BoxHOD(varied_params, config_file: str = None, cosmo_idx: int = 0, phase_idx: int = 0, sim_type: str = 'base', redshift: float = 0.5, DM_DICT: dict = LRG_Abacus_DM)[source]

Bases: object

BoxHOD is a wrapper around AbacusHOD, a class for handling Halo Occupation Distribution (HOD) modeling using the AbacusSummit simulations.

Note

Only the ‘LRG’ tracers are currently supported. Note that BGS is also supported, by using tracer=’LRG’ and BGS characteristics (mean density, redshift, etc.)

Initialize the BoxHOD class.

Parameters:
  • varied_params (dict) – Dictionary of parameters that vary.

  • config_file (str, optional) – Path to the configuration file. If None, defaults to ‘box.yaml’ in acm.hod. See setup() for more details. Default is None.

  • cosmo_idx (int, optional) – Index of the cosmology to use. Default is 0.

  • phase_idx (int, optional) – Index of the phase to use. Default is 0.

  • sim_type (str, optional) – Type of simulation. Must be either ‘base’ or ‘small’. Default is ‘base’.

  • redshift (float, optional) – Redshift value. Default is 0.5.

  • DM_DICT (dict, optional) – Dictionary containing dark matter information. Default is the LRG_Abacus_DM dictionary for boxes from acm.data.paths.

Raises:

ValueError – If sim_type is not ‘base’ or ‘small’.

logger = <Logger AbacusHOD (INFO)>
setup(config: dict, DM_DICT: dict)[source]

Set up the simulation parameters and initialize the AbacusHOD object. This method overrides most of the configuration file settings with the provided config and DM_DICT parameters.

Parameters:
  • config (dict) – Configuration dictionary containing simulation parameters and HOD parameters.

  • DM_DICT (dict) – Dictionary containing dark matter simulation directories.

abacus_simdirs(DM_DICT: dict)[source]

Get the simulation and subsample directories from the dark matter dictionary.

Parameters:

DM_DICT (dict) – Dictionary containing dark matter simulation directories.

Returns:

Tuple containing the simulation and subsample directories.

Return type:

tuple

abacus_simname()[source]

Get the simulation name.

Returns:

Simulation name, following the Abacus format.

Return type:

str

check_params(params)[source]

Check if the parameters are valid, i.e. if they are in the list of valid parameters.

Parameters:

params (list) – List of parameters to check.

Raises:

ValueError – If the parameters are invalid.

run(hod_params: dict, nthreads: int = 1, tracer: str = 'LRG', tracer_density: list = None, process_underdense: bool = True, seed=None, save_fn: str | Path = None, add_ap: bool = False) dict[source]

Run the HOD model with the given parameters.

Parameters:
  • hod_params (dict) – Dictionary of HOD parameters.

  • nthreads (int, optional) – Number of threads to use. Default is 1.

  • tracer (str, optional) – Tracer type. Default is ‘LRG’.

  • tracer_density (list, optional) – List containing (min_nbar, max_nbar) for downsampling catalogue to desired density (nbar > max_nbar) or cutting from sample (nbar < min_nbar). If only one value provided, this is taken as the maximum threshold (no minimum threshold applied). Default is None (no thresholds applied).

  • process_underdense (bool, optional) – If set to False, does not process (and save) catalogs that are not in tracer_density limits (only used if tracer_density is provided). Defaults to True.

  • seed (int, optional) – Random seed. Default is None.

  • save_fn (str|Path, optional) – Filename to save the catalog. Creates parent tree if it does not exist. Default is None.

  • add_ap (bool, optional) – Whether to take Alcock-Paczynski distortions into account when computing the number density. To use if you plan to apply AP distortions to the catalog later on. Default is False.

Returns:

Dictionary containing the HOD catalog. Galaxy positions (‘X’,’Y’,’Z’) and velocities (‘VX’,’VY’,’VZ’) are in real-space. To get positions with RSD and/or AP distortions, use the get_positions class method.

Return type:

dict

Raises:
  • ValueError – If the tracer is not ‘LRG’.

  • ValueError – If the HOD parameters do not match the varied parameters.

postprocess_catalog(hod_dict: dict, tracer: str = 'LRG', subsample: list = None)[source]

Add distortion effects and format the HOD catalog.

Parameters:
  • hod_dict (dict) – Dictionary containing the HOD catalog.

  • tracer (str, optional) – Tracer type. Default is ‘LRG’.

  • subsample (list, optional) – List of indices used to subsample the catalogue.

Returns:

Dictionary containing the HOD catalog.

Return type:

dict

save_catalog(save_fn: str | Path, hod_dict: dict, tracer: str = 'LRG')[source]

Save the HOD catalog to a FITS file.

Parameters:
  • save_fn (str|Path) – Filename to save the catalog. If parent tree directories do not exist, they will be created.

  • hod_dict (dict) – Dictionary containing the HOD catalog.

  • tracer (str, optional) – Tracer type. Default is ‘LRG’.

param_mapping(hod_params: dict | list)[source]

Map custom HOD parameters to Abacus HOD parameters.

Parameters:

hod_params (dict or list) – Dictionary or list of HOD parameters.

Returns:

Dictionary or list of AbacusHOD parameters.

Return type:

dict or list

Raises:

ValueError – If the type of hod_params is not dict or list.

classmethod get_boxsize(boxsize: float | list, add_ap: bool = False, los: str = None, q_par: float = None, q_perp: float = None) float | list[source]

Get the box size, taking into account Alcock-Paczynski distortions if specified.

Parameters:
  • boxsize (float|list) – Original box size (as a float or a list of three floats for each axis).

  • add_ap (bool, optional) – Whether to add Alcock-Paczynski distortions to the box size or not. Default is False.

  • los (str, optional) – Line-of-sight for AP distortions. If None, no distortions are applied.

  • q_par (float, optional) – Parallel AP distortion factor. Required if los is not None.

  • q_perp (float, optional) – Perpendicular AP distortion factor. Required if los is not None.

Returns:

Box size after applying AP distortions, or original box size if no distortions are applied.

Return type:

float or np.ndarray

classmethod get_positions(hod_dict: dict, tracer: str = None, los: str = None, add_rsd: bool = False, hubble: float = None, az: float = None, boxsize: float = None, add_ap: bool = False, q_par: float = None, q_perp: float = None) ndarray[source]

Get the galaxy positions from the HOD catalog.

Parameters:
  • hod_dict (dict) – Dictionary containing the tracer positions.

  • tracer (str, optional) – Tracer type to read from hod_dict. If None, uses the top-level keys of hod_dict. Default is None.

  • los (str, optional) – Line-of-sight for RSD and AP distortions. If None, no distortions are applied.

  • add_rsd (bool, optional) – Whether to add redshift-space distortions to the catalog or not. Default is False.

  • hubble (float, optional) – Hubble parameter at the redshift of the catalog. Required if add_rsd is True.

  • az (float, optional) – Scale factor at the redshift of the catalog. Required if add_rsd is True.

  • boxsize (float, optional) – Box size of the simulation. Required if add_rsd is True.

  • add_ap (bool, optional) – Whether to add Alcock-Paczynski distortions to the number density or not. Default is False.

  • q_par (float, optional) – Parallel AP distortion factor. Required if add_ap is True.

  • q_perp (float, optional) – Perpendicular AP distortion factor. Required if add_ap is True.

Returns:

Array of galaxy positions with shape (N_gal, 3).

Return type:

np.ndarray

acm.hod.cutsky#

acm.hod.lightcone#

acm.hod.parameters#