# Density Profiles¶

Most cluster observables are closely related to their density profiles. This repository contains routines for calcalating the NFW and Einasto profiles.

## NFW Profile¶

The NFW profile (arxiv) is a 3D density profile given by:

The free parameters are the cluster mass \(M_\Delta\) and concentration \(c_\Delta = r_\Delta/r_s\). In this module we choose to define the density with respect to the matter background density \(\Omega_m\rho_{\rm crit}\). The scale radius \(r_s\) is given in \(h^{-1}{\rm Mpc}\), however the code uses concentration \(c_\Delta\) as an argument instead. The normalization \(\delta_c\) is calculated internally and depends only on the concentration. As written, because of the choice of units the only cosmological parameter that needs to be passed in is \(\Omega_m\).

Note

The density profiles can use \(\Delta\neq 200\).

To use this, you would do:

```
from cluster_toolkit import density
import numpy as np
radii = np.logspace(-2, 3, 100) #Mpc/h comoving
mass = 1e14 #Msun/h
concentration = 5 #arbitrary
Omega_m = 0.3
rho_nfw = density.rho_nfw_at_r(radii, mass, concentration, Omega_m)
```

## Einasto Profile¶

The Einasto profile is a 3D density profile given by:

In this model, the free parameters are the scale radius \(r_s\), \(\alpha\), and the cluster mass \(M_\Delta\). The scale density \(\rho_s\) is calculated internally, or can be passed in instead of mass. To use this, you would do:

```
from cluster_toolkit import density
import numpy as np
radii = np.logspace(-2, 3, 100) #Mpc/h comoving
mass = 1e14 #Msun/h
r_scale = 1.0 #Mpc/h comoving scale radius
alpha = 0.19 #arbitrary; a typical value
Omega_m = 0.3
rho_ein = density.rho_einasto_at_r(radii, mass, r_scale, alpha, Omega_m)
```

We can see the difference between these two profiles here: