# MonteCarloGalProf¶

class halotools.empirical_models.MonteCarloGalProf[source] [edit on github]

Bases: object

Orthogonal mix-in class used to turn an analytical phase space model (e.g., NFWPhaseSpace) into a class that can generate the phase space distribution of a mock galaxy population.

Notes

In principle, this class can work with any analytical profile. In practice, the implementation here is based on building lookup tables to perform the inverse transformation sampling, and so the MonteCarloGalProf class will not be performant when used with models having more than two profile parameters.

Methods Summary

 build_lookup_tables([logrmin, logrmax, …]) Method used to create a lookup table of the spatial and velocity radial profiles. mc_halo_centric_pos(*profile_params, **kwargs) Method to generate random, three-dimensional halo-centric positions of galaxies. mc_pos(*profile_params, **kwargs) Method to generate random, three-dimensional positions of galaxies. mc_radial_velocity(scaled_radius, …) Method returns a Monte Carlo realization of radial velocities drawn from Gaussians with a width determined by the solution to the isotropic Jeans equation. mc_solid_sphere(*profile_params, **kwargs) Method to generate random, three-dimensional, halo-centric positions of galaxies. mc_unit_sphere(Npts, **kwargs) Returns Npts random points on the unit sphere. mc_vel(table[, overwrite_table_velocities, …]) Method assigns a Monte Carlo realization of the Jeans velocity solution to the halos in the input table. setup_prof_lookup_tables(…) Method used to set up the lookup table grid.

Methods Documentation

build_lookup_tables(logrmin=-3, logrmax=0, Npts_radius_table=101)[source] [edit on github]

Method used to create a lookup table of the spatial and velocity radial profiles.

Parameters: logrmin : float, optional Minimum radius used to build the spline table. Default is set in model_defaults. logrmax : float, optional Maximum radius used to build the spline table Default is set in model_defaults. Npts_radius_table : int, optional Number of control points used in the spline. Default is set in model_defaults.
mc_halo_centric_pos(*profile_params, **kwargs)[source] [edit on github]

Method to generate random, three-dimensional halo-centric positions of galaxies.

Parameters: table : data table, optional Astropy Table storing a length-Ngals galaxy catalog. If table is not passed, profile_params and keyword argument halo_radius must be passed. *profile_params : Sequence of arrays Sequence of length-Ngals array(s) containing the input profile parameter(s). In the simplest case, this sequence has a single element, e.g. a single array storing values of the NFW concentrations of the Ngals galaxies. More generally, there should be a profile_params sequence item for every parameter in the profile model, each item a length-Ngals array. If profile_params is passed, halo_radius must be passed as a keyword argument. The sequence must have the same order as self.gal_prof_param_keys. halo_radius : array_like, optional Length-Ngals array storing the radial boundary of the halo hosting each galaxy. Units assumed to be in Mpc/h. If profile_params and halo_radius are not passed, table must be passed. seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results. x, y, z : arrays Length-Ngals array storing a Monte Carlo realization of the galaxy positions.
mc_pos(*profile_params, **kwargs)[source] [edit on github]

Method to generate random, three-dimensional positions of galaxies.

Parameters: table : data table, optional Astropy Table storing a length-Ngals galaxy catalog. If table is not passed, profile_params and halo_radius must be passed. *profile_params : Sequence of arrays Sequence of length-Ngals array(s) containing the input profile parameter(s). In the simplest case, this sequence has a single element, e.g. a single array storing values of the NFW concentrations of the Ngals galaxies. More generally, there should be a profile_params sequence item for every parameter in the profile model, each item a length-Ngals array. If profile_params is passed, halo_radius must be passed as a keyword argument. The sequence must have the same order as self.gal_prof_param_keys. halo_radius : array_like, optional Length-Ngals array storing the radial boundary of the halo hosting each galaxy. Units assumed to be in Mpc/h. If profile_params and halo_radius are not passed, table must be passed. overwrite_table_pos : bool, optional If True, the mc_pos method will over-write the existing values of the x, y and z table columns. Default is True return_pos : bool, optional If True, method will return the computed host-centric values of x, y and z. Default is False. seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results. x, y, z : arrays, optional For the case where no table is passed as an argument, method will return x, y and z points distributed about the origin according to the profile model. For the case where table is passed as an argument (this is the use case of populating halos with mock galaxies), the x, y, and z columns of the table will be over-written. When table is passed as an argument, the method assumes that the x, y, and z columns already store the position of the host halo center.
mc_radial_velocity(scaled_radius, total_mass, *profile_params, **kwargs)[source] [edit on github]

Method returns a Monte Carlo realization of radial velocities drawn from Gaussians with a width determined by the solution to the isotropic Jeans equation.

Parameters: scaled_radius : array_like Halo-centric distance r scaled by the halo boundary $$R_{\Delta}$$, so that $$0 <= \tilde{r} \equiv r/R_{\Delta} <= 1$$. Can be a scalar or numpy array. total_mass: array_like Length-Ngals numpy array storing the halo mass in $$M_{\odot}/h$$. *profile_params : Sequence of arrays Sequence of length-Ngals array(s) containing the input profile parameter(s). In the simplest case, this sequence has a single element, e.g. a single array storing values of the NFW concentrations of the Ngals galaxies. More generally, there should be a profile_params sequence item for every parameter in the profile model, each item a length-Ngals array. The sequence must have the same order as self.gal_prof_param_keys. seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results. radial_velocities : array_like Array of radial velocities drawn from Gaussians with a width determined by the solution to the isotropic Jeans equation.
mc_solid_sphere(*profile_params, **kwargs)[source] [edit on github]

Method to generate random, three-dimensional, halo-centric positions of galaxies.

Parameters: *profile_params : Sequence of arrays Sequence of length-Ngals array(s) containing the input profile parameter(s). In the simplest case, this sequence has a single element, e.g. a single array storing values of the NFW concentrations of the Ngals galaxies. More generally, there should be a profile_params sequence item for every parameter in the profile model, each item a length-Ngals array. The sequence must have the same order as self.gal_prof_param_keys. table : data table, optional Astropy Table storing a length-Ngals galaxy catalog. If table is not passed, profile_params must be passed. seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results. x, y, z : arrays Length-Ngals array storing a Monte Carlo realization of the galaxy positions.
mc_unit_sphere(Npts, **kwargs)[source] [edit on github]

Returns Npts random points on the unit sphere.

Parameters: Npts : int Number of 3d points to generate seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results. x, y, z : array_like Length-Npts arrays of the coordinate positions.
mc_vel(table, overwrite_table_velocities=True, return_velocities=False, seed=None)[source] [edit on github]

Method assigns a Monte Carlo realization of the Jeans velocity solution to the halos in the input table.

Parameters: table : Astropy Table astropy.table.Table object storing the halo catalog. overwrite_table_velocities : bool, optional If True, the mc_vel method will over-write the existing values of the vx, vy and vz columns. Default is True return_velocities : bool, optional If True, method will return the computed values of vx, vy and vz. Default is False. seed : int, optional Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Notes

The method assumes that the vx, vy, and vz columns already store the position of the host halo center.

setup_prof_lookup_tables(*lookup_table_binning_arrays)[source] [edit on github]

Method used to set up the lookup table grid.

Each analytical profile has profile parameters associated with it. This method sets up how we will digitize the value of each such parameter for the purposes of mock population.

Parameters: *lookup_table_binning_arrays : sequence Sequence of arrays storing the bins for each profile parameter.