CorrHOD.utils#

CorrHOD.utils.apply_rsd(data, boxsize, redshift, cosmo, tracer='LRG', los='z')[source][source]#

Read positions and velocities from HOD dict and applies Redshift-Space Distortions (RSD).

Parameters:
  • data (dict) – HOD dict containing the positions and velocities of the tracer (data[tracer]) It can also be a positional dataset, in which case it must contain the keys ‘x’, ‘y’, ‘z’, ‘vx’, ‘vy’, ‘vz’

  • boxsize (float) – Size of the simulation box in Mpc/h.

  • redshift (float) – Redshift of the simulation snapshot.

  • cosmo (cosmology object (cosmoprimo)) – Cosmology used for the simulation. It must contain an efunc(z) method.

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

  • los (str, optional) – Line-of-sight direction in which to apply the RSD. Default is ‘z’.

Returns:

x, y, z – Redshift-space positions of the tracer. The los axis is replaced by the redshift-space position.

Return type:

arrays

CorrHOD.utils.array_to_dict(array, is_log_sigma=False)[source][source]#

Converts an array of values into a dictionary of HOD parameters

Parameters:

array (array_like) – Array of values for the HOD parameters. The order of the parameters must be the following: [logM_cut, logM1, sigma, alpha, kappa, alpha_c, alpha_s, Bcent, Bsat]

Returns:

hod_dict – Dictionary of HOD parameters

Return type:

dict

CorrHOD.utils.dict_to_array(dic: dict)[source][source]#

Converts a dictionary of HOD parameters into an array of values

Parameters:

dic (dict) – Dictionary of HOD parameters. The keys must be the following: [‘logM_cut’, ‘logM1’, ‘sigma’, ‘alpha’, ‘kappa’, ‘alpha_c’, ‘alpha_s’, ‘Bcent’, ‘Bsat’]

Returns:

array – Array of values for the HOD parameters

Return type:

array_like

CorrHOD.utils.format_HOD_CFs(path: str, output_dir: str, cosmo: int = 0, phase: int = 0, HOD_start: int = 0, HOD_number: int = 1, nquantiles=10, smoothing_filter: str = 'gaussian', smoothing_radius: float = 10, merge_2PCF: bool = True, merge_DS_auto: bool = True, merge_DS_cross: bool = True)[source][source]#

Creates a dictionary of the CFs from the saved files. This should bring all the files in the same format as the one used by Sunbird.

It will return for each CF, one file per cosmology and phase, with the following format: * s: array of separation bins * multipoles: array of shape (HOD_number, los_number(3), nquantiles, npoles(3), sep_bin_number)

The name of the file is : * tpcf_c{cosmo}_p{phase}.npy for the 2PCF * ds_auto_zsplit_Rs{smoothing_radius}_c{cosmo}_p{phase}.npy for the DS auto (zsplit because the density is split in redshift space)

Note that it is assumed that the files that we want to merge are all exist, and are respectively in a directory named tpcf and ds/{smoothing_filter} from the given path. An error will be raised if any of the files is missing.

It is also assumed that the separation bins are the same for all the files (tpcf, cross and auto). A check is done to verify that.

Parameters:
  • path (str) – Path to the directory containing the saved files

  • output_dir (str) – Path to the directory where the formatted files will be saved

  • cosmo (int, optional) – Cosmology number, same as the one used in AbacusSummit. Defaults to 0

  • phase (int, optional) – Phase number, same as the one used in AbacusSummit. Defaults to 0

  • HOD_start (int, optional) – HOD number to start from. Defaults to 0

  • HOD_number (int, optional) – Number of HODs to merge. Defaults to 1

  • nquantiles (int, optional) – Number of quantiles used to split the sample. Defaults to 10

  • smoothing_filter (str, optional) – Smoothing filter used to compute the DensitySplit (see epaillas/densitysplit for more details). Defaults to ‘gaussian’

  • smoothing_radius (float, optional) – Smoothing radius used to compute the DensitySplit (see epaillas/densitysplit for more details). Defaults to 10

  • merge_2PCF (bool, optional) – Whether to merge the 2PCF files. Defaults to True

  • merge_DS_auto (bool, optional) – Whether to merge the quantiles auto-correlation files. Defaults to True

  • merge_DS_cross (bool, optional) – Whether to merge the quantiles cross-correlation files. Defaults to True