Mock#

This module create mocks of halos and galaxies.

pyexshalos.mock.Generate_Galaxies_from_Halos(posh: ndarray, Mh: ndarray, velh: ndarray | None = None, Ch: ndarray | None = None, nd: int = 256, ndx: int = 0, ndy: int = 0, ndz: int = 0, Lc: float = 2.0, Om0: float = 0.31, z: float = 0.0, logMmin: float = 13.25424743, siglogM: float = 0.26461332, logM0: float = 13.28383025, logM1: float = 14.32465146, alpha: float = 1.00811277, sigma: float = 0.5, Deltah: float = -1.0, seed: int = 12345, OUT_VEL: bool = False, OUT_FLAG: bool = False, verbose: bool = False) Dict[str, ndarray]#

Generate a galaxy catalogue from halo cataloguw.

Parameters:
  • posh (numpy.ndarray) – Positions of the halos.

  • Mh (numpy.ndarray) – Mass of the halos.

  • velh (Optional[numpy.ndarray]) – Velocities of the halos. Fiducial value: None

  • Ch (Optional[numpy.ndarray]) – Concentration of the halos. Fiducial value: None

  • nd (int) – Number of cells in each direction. Fiducial value: 256

  • ndx (int) – Number of cells in the x direction. Fiducial value: nd

  • ndy (int) – Number of cells in the y direction. Fiducial value: nd

  • ndz (int) – Number of cells in the z direction. Fiducial value: nd

  • Lc (float) – Size of each cell in Mpc/h. Fiducial value: 2.0

  • Om0 (float) – Value of the matter overdensity today. Fiducial value: 0.31

  • z (float) – Redshift of the density grid and final galaxy catalogue. Fiducial value: 0.0

  • logMmin (float) – Parameter of the HOD models (Zheng 2005). Fiducial value: 13.25424743

  • siglogM (float) – Parameter of the HOD models (Zheng 2005). Fiducial value: 0.26461332

  • logM0 (float) – Parameter of the HOD models (Zheng 2005). Fiducial value: 13.28383025

  • logM1 (float) – Parameter of the HOD models (Zheng 2005). Fiducial value: 14.32465146

  • alpha (float) – Parameter of the HOD models (Zheng 2005). Fiducial value: 1.00811277

  • sigma (float) – Parameter of the exclusion term of the halo density profile (Voivodic 2020). Fiducial value: 0.5

  • Deltah (float) – Overdensity of the halos. Fiducial value: -1.0

  • seed (int) – Seed used to generate the random numbers. Fiducial value: 12345

  • OUT_VEL (bool) – Whether to output the velocities of galaxies. Fiducial value: False

  • OUT_FLAG (bool) – Whether to output the flag of galaxies (central or satellite). Fiducial value: False

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

Returns:

Dictionary with the following keys:

  • ”posg”: ndarray with galaxy positions

  • ”velg”: ndarray with galaxy velocities

  • ”flag”: ndarray with galaxy flags

Return type:

dict

pyexshalos.mock.Generate_Halos_Box_from_Grid(grid: ndarray, k: ndarray, P: ndarray, S: ndarray | None = None, V: ndarray | None = None, Lc: float = 2.0, Om0: float = 0.31, z: float = 0.0, k_smooth: float = 10000.0, delta_c: float = -1.0, Nmin: int = 1, a: float = 1.0, beta: float = 0.0, alpha: float = 0.0, OUT_LPT: bool = False, OUT_VEL: bool = False, DO_2LPT: bool = False, OUT_FLAG: bool = False, OUT_PROF: bool = False, verbose: bool = False, nthreads: int = 1) Dict[str, ndarray]#

Generates a halo catalogue, in a box, from a density grid.

Parameters:
  • grid (numpy.ndarray) – Density grid used to generate the halos.

  • k (numpy.ndarray) – Wavenumbers of the power spectrum. Fiducial value.

  • P (numpy.ndarray) – Power spectrum.

  • S (Optional[numpy.ndarray]) – Displacements of the particles in the grid. Fiducial value: None

  • V (Optional[numpy.ndarray]) – Velocity of the particles in the grid. Fiducial value: None

  • Lc (float) – Size of each cell in Mpc/h. Fiducial value: 2.0

  • Om0 (float) – Value of the matter overdensity today. Fiducial value: 0.31

  • z (float) – Redshift of the density grid and final halo catalogue. Fiducial value: 0.0

  • k_smooth (float) – Scale used to smooth the LPT computations. Fiducial value: 10000.0

  • delta_c (float) – Critical density of the halo formation linearly extrapolated to z. Fiducial value: -1.0

  • Nmin (int) – Minimum number of particles in each halo. Fiducial value: 1

  • a (float) – Parameter a of the ellipsoidal barrier. Fiducial value: 1.0

  • beta (float) – Parameter beta of the ellipsoidal barrier. Fiducial value: 0.0

  • alpha (float) – Parameter alpha of the ellipsoidal barrier. Fiducial value: 0.0

  • OUT_LPT (bool) – Whether to output the displaced particles. Fiducial value: False

  • OUT_VEL (bool) – Whether to output the velocities of halos and particles. Fiducial value: False

  • DO_2LPT (bool) – Whether to use the second order LPT to displace the halos and particles. Fiducial value: False

  • OUT_FLAG (bool) – Whether to output the flag corresponding to the host halo of each particle. Fiducial value: False

  • OUT_PROF (bool) – (Not working yet) Whether to output density profiles of the Lagrangian halos. Fiducial value: False

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

  • nthreads (int) – Number of threads to be used in some computations. Fiducial value: 1

Returns:

Dictionary with the following keys:

  • ”posh”: ndarray with halo positions

  • ”velh”: ndarray with halo velocities

  • ”Mh”: ndarray with halo masses

  • ”pos”: ndarray with particle positions

  • ”vel”: ndarray with particle velocities

  • ”flag”: ndarray with particle flags

Return type:

dict

pyexshalos.mock.Generate_Halos_Box_from_Pk(k: ndarray, P: ndarray, R_max: float = 100000.0, nd: int = 256, ndx: int = 0, ndy: int = 0, ndz: int = 0, Lc: float = 2.0, Om0: float = 0.31, z: float = 0.0, k_smooth: float = 10000.0, delta_c: float = -1.0, Nmin: int = 1, a: float = 1.0, beta: float = 0.0, alpha: float = 0.0, seed: int = 12345, fixed: bool = False, phase: float = 0.0, OUT_DEN: bool = False, OUT_LPT: bool = False, OUT_VEL: bool = False, OUT_PROF: bool = False, DO_2LPT: bool = False, OUT_FLAG: bool = False, verbose: bool = False, nthreads: int = 1) Dict[str, ndarray]#

Generates halos, in a box, from a power spectrum.

Parameters:
  • k (numpy.ndarray) – Wavenumbers of the power spectrum.

  • P (numpy.ndarray) – Power spectrum.

  • R_max (float) – Maximum size used to compute the correlation function in Mpc/h. Fiducial value: 100000.0

  • nd (int) – Number of cells in each direction. Fiducial value: 256

  • ndx (int) – Number of cells in x direction. Fiducial value: nd

  • ndy (int) – Number of cells in y direction. Fiducial value: nd

  • ndz (int) – Number of cells in z direction. Fiducial value: nd

  • Lc (float) – Size of each cell in Mpc/h. Fiducial value: 2.0

  • Om0 (float) – Value of the matter overdensity today. Fiducial value: 0.31

  • z (float) – Redshift of the density grid and final halo catalogue. Fiducial value: 0.0

  • k_smooth (float) – Scale used to smooth the LPT computations. Fiducial value: 10000.0

  • delta_c (float) – Critical density of the halo formation linearly extrapolated to z. Fiducial value: -1

  • Nmin (int) – Minimum number of particles in each halo. Fiducial value: 1

  • a (float) – Parameter a of the ellipsoidal barrier. Fiducial value: 1.0

  • beta (float) – Parameter beta of the ellipsoidal barrier. Fiducial value: 0.0

  • alpha (float) – Parameters alpha of the ellipsoidal barrier. Fiducial value: 0.0

  • seed (int) – Seed used to generate the density field. Fiducial value: 12345

  • fixed (bool) – Whether to use fixed amplitudes of the Gaussian field. Fiducial value: False

  • phase (float) – Phase of the Gaussian field. Fiducial value: 0.0

  • OUT_DEN (bool) – Whether to output the density field. Fiducial value: False

  • OUT_LPT (bool) – Whether to output the displaced particles. Fiducial value: False

  • OUT_VEL (bool) – Whether to output the velocities of halos and particles. Fiducial value: False

  • OUT_PROF (bool) – Whether to output the density profile of the Lagrangian halos. Fiducial value: False

  • DO_2LPT (bool) – Whether to use the second order LPT to displace the halos and particles. Fiducial value: False

  • OUT_FLAG (bool) – Whether to output the flag corresponding to the host halo of each particle. Fiducial value: False

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

  • nthreads (int) – Number of threads to be used in some computations. Fiducial value: 1

Returns:

Dictionary with the following keys:

  • ”posh”: ndarray with halo positions

  • ”velh”: ndarray with halo velocities

  • ”Mh”: ndarray with halo masses

  • ”pos”: ndarray with particle positions

  • ”vel”: ndarray with particle velocities

  • ”flag”: ndarray with particle flags

  • ”grid”: ndarray with the Gaussian density grid

  • ”Prof”: ndarray with the density profile of the Lagrangian halos

  • ”ProfM”: ndarray with the mass in each shell of the profile

Return type:

dict

pyexshalos.mock.Split_Galaxies(Mh: ndarray, Flag: ndarray, params_cen: ndarray = array([37.10265321, -5.07596644, 0.17497771]), params_sat: ndarray = array([19.84341938, -2.8352781, 0.10443049]), seed: int = 12345, verbose: bool = False) ndarray#

Split galaxies into central and satellite types based on their properties.

Parameters:
  • Mh (numpy.ndarray) – Mass of the halos.

  • Flag (numpy.ndarray) – Flag with the label splitting central and satellites.

  • params_cen (numpy.ndarray) – Parameters used to split the central galaxies. Fiducial value: [37.10265321, -5.07596644, 0.17497771]

  • params_sat (numpy.ndarray) – Parameters used to split the satellite galaxies. Fiducial value: [19.84341938, -2.8352781, 0.10443049]

  • seed (int) – Seed used to generate the random numbers. Fiducial value: 12345

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

Returns:

Type of each galaxy.

Return type:

numpy.ndarray