halomod.profiles.Profile

class halomod.profiles.Profile(cm_relation, mdef=<hmf.halos.mass_definitions.SOMean object>, z=0.0, cosmo=FlatLambdaCDM(name='Planck15', H0=<Quantity 67.74 km / (Mpc s)>, Om0=0.3075, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.0486), **model_parameters)[source]

Bases: Component

Halo radial density profiles.

This class provides basic building blocks for all kinds of fun with halo radial density profiles. It is modeled on the system described in arXiv:2009.14066. This means that subclasses providing specific profiles shapes, f(x) must provide very minimal other information for a range of products to be available.

The “main” quantities available are the halo_profile itself, its fourier pair, and its convolution (this is not available for every halo_profile). Furthermore, quantities such as the halo_concentration-mass relation are provided, along with tools such as those to generate a mock halo of the given halo_profile.

Parameters:
  • cm_relation (CMRelation instance) – Identifies which halo-concentration-mass relation to use.

  • mdef (hmf.halos.mass_definitions.MassDefinition instance) – A mass definition to interpret input masses with.

  • z (float, default 0.0) – The redshift of the halo

cdf(r, c=None, m=None, coord='r')[source]

The cumulative distribution function, \(m(<x)/m_v\).

Parameters:
  • r (float or array_like) – The radial location – units defined by coord

  • c (float or array_like, optional) – The halo_concentration. Only used if m not provided

  • m (float or array_like, optional) – The mass of the halo. Defines the halo_concentration if provided.

  • coord (str, {"x", "r", "s"}) – What the radial coordinate represents. r represents physical co-ordinates [units Mpc/h]. x is in units of the scale radius (r_vir = c), and s is in units of the virial radius (r_vir = 1).

cm_relation(m: [<class 'float'>, <class 'numpy.ndarray'>]) [<class 'float'>, <class 'numpy.ndarray'>][source]

The halo_concentration-mass relation.

classmethod get_models() Dict[str, Type]

Get a dictionary of all implemented models for this component.

halo_mass_to_radius(m, at_z=False)[source]

Return the halo radius corresponding to m.

Note that this is the radius corresponding to the halo at redshift zero, even if the redshift of the profile is not zero.

halo_radius_to_mass(r, at_z=False)[source]

Return the halo mass corresponding to r.

lam(r, m, norm='m', c=None, coord='r')[source]

The density halo_profile convolved with itself.

Parameters:
  • r (float or array of floats) – The radial location(s). The units vary according to coord

  • m (float or array of floats) – The mass(es) of the halo(s)

  • norm (str, {None,``m``,``rho``}) – Normalisation of the density.

  • c (float or array of floats, default None) – Concentration(s) of the halo(s). Must be same length as m.

  • coord (str, {r,``x``,``s``}) – What the radial coordinate represents. r represents physical co-ordinates [units Mpc/h]. x is in units of the scale radius (r_vir = c), and s is in units of the virial radius (r_vir = 1).

populate(n, m, c=None, centre=None, rng=None)[source]

Populate a halo with the current halo profile of mass m with n tracers.

Parameters:
  • n (int) – Number of tracers to place down

  • m (float) – Mass of the halo.

  • c (float, optional) – Concentration of the halo. Will be calculated if not given.

  • centre (3-array) – (x,y,z) co-ordinates of centre of halo. Default is zero.

Returns:

pos – Array of positions of the tracers, centred around (0,0,0).

Return type:

(N,3)-array

rho(r, m, norm=None, c=None, coord='r')[source]

The density at radius r of a halo of mass m.

Parameters:
  • r (float or array of floats) – The radial location(s). The units vary according to coord

  • m (float or array of floats) – The mass(es) of the halo(s)

  • norm (str, {m,``rho``}) – Normalisation of the density.

  • c (float or array of floats, default None) – Concentration(s) of the halo(s). Must be same length as m.

  • coord (str, {r,``x``,``s``}) – What the radial coordinate represents. r represents physical co-ordinates [units Mpc/h]. x is in units of the scale radius (x(r_vir) = c), and s is in units of the virial radius (s(r_vir) = 1).

scale_radius(m: float | ndarray, at_z: bool = False) float | ndarray[source]

Return the scale radius for a halo of mass m.

The scale radius is defined as \(r_s = r_vir(m) / c(m)\).

Parameters:
  • m – Mass of the halo(s), in units of M_sun / h.

  • at_z – If true, return the redshift-dependent configuration-space scale radius of the halo. Otherwise, return the redshift-independent Lagrangian-space scale radius (based on an initial density patch).

Returns:

The scale radius, same type as m.

Return type:

r_s

u(k, m, norm='m', c=None, coord='k')[source]

The (optionally normalised) Fourier-transform of the density halo_profile.

Parameters:
  • k (float or array of floats) – The radial wavenumber(s). The units vary according to coord

  • m (float or array of floats) – The mass(es) of the halo(s)

  • norm (str, {None,``m``,``rho``}) – Normalisation of the density.

  • c (float or array of floats, default None) – Concentration(s) of the halo(s). Must be same length as m.

  • coord (str, {k,``kappa``}) – What the radial coordinate represents. r represents physical wavenumbers [units h/Mpc]. kappa is in units of the scale radius, kappa = k*rs.

virial_velocity(m=None, r=None)[source]

Return the virial velocity for a halo of mass m.

Either m or r must be passed. If both are passed, m is preferentially used.

Parameters:
  • m (array_like, optional) – Masses of halos.

  • r (array_like, optional) – Radii of halos.