MonteCarloGalProf

class halotools.empirical_models.MonteCarloGalProf[source]

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]

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

Parameters:
logrminfloat, optional

Minimum radius used to build the spline table. Default is set in model_defaults.

logrmaxfloat, optional

Maximum radius used to build the spline table Default is set in model_defaults.

Npts_radius_tableint, optional

Number of control points used in the spline. Default is set in model_defaults.

mc_halo_centric_pos(*profile_params, **kwargs)[source]

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

Parameters:
tabledata 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_paramsSequence 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_radiusarray_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.

seedint, optional

Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Returns:
x, y, zarrays

Length-Ngals array storing a Monte Carlo realization of the galaxy positions.

mc_pos(*profile_params, **kwargs)[source]

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

Parameters:
tabledata table, optional

Astropy Table storing a length-Ngals galaxy catalog. If table is not passed, profile_params and halo_radius must be passed.

*profile_paramsSequence 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_radiusarray_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_posbool, 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_posbool, optional

If True, method will return the computed host-centric values of x, y and z. Default is False.

seedint, optional

Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Returns:
x, y, zarrays, 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]

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_radiusarray_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_paramsSequence 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.

seedint, optional

Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Returns:
radial_velocitiesarray_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]

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

Parameters:
*profile_paramsSequence 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.

tabledata table, optional

Astropy Table storing a length-Ngals galaxy catalog. If table is not passed, profile_params must be passed.

seedint, optional

Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Returns:
x, y, zarrays

Length-Ngals array storing a Monte Carlo realization of the galaxy positions.

mc_unit_sphere(Npts, **kwargs)[source]

Returns Npts random points on the unit sphere.

Parameters:
Nptsint

Number of 3d points to generate

seedint, optional

Random number seed used in the Monte Carlo realization. Default is None, which will produce stochastic results.

Returns:
x, y, zarray_like

Length-Npts arrays of the coordinate positions.

mc_vel(table, overwrite_table_velocities=True, return_velocities=False, seed=None)[source]

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

Parameters:
tableAstropy Table

astropy.table.Table object storing the halo catalog.

overwrite_table_velocitiesbool, optional

If True, the mc_vel method will over-write the existing values of the vx, vy and vz columns. Default is True

return_velocitiesbool, optional

If True, method will return the computed values of vx, vy and vz. Default is False.

seedint, 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]

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_arrayssequence

Sequence of arrays storing the bins for each profile parameter.