Skip to content

Commit 2a133dc

Browse files
SUTIENG TamSUTIENG Tam
authored andcommitted
Add concentration, radius, Delta_Sigma functions to halos
1 parent 1e08d4e commit 2a133dc

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

skypy/halos/_colossus.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,134 @@ def colossus_mf(redshift, model, mdef, m_min, m_max, sky_area, cosmology,
203203
cosmology, sigma8, ns, size, resolution)
204204

205205
return z, m
206+
207+
def concentration(mass, mdef, redshift, model, cosmology, sigma8, ns)
208+
"""Halo concentration calculator.
209+
210+
This function calculates halo concentration(s) using the model of c-M relation
211+
available in colossus.
212+
213+
Parameters
214+
----------
215+
mass : float or array_like
216+
Spherical overdensity halo mass in units of solar mass/h, corresponding
217+
to the mass definition, mdef.
218+
mdef : str
219+
Halo mass definition for spherical overdensities used by colossus.
220+
redshift : float
221+
Halo redshift
222+
model : string
223+
The model of the c-M relation which is available in colossus.
224+
cosmology : astropy.cosmology.Cosmology
225+
Astropy cosmology object
226+
sigma8 : float
227+
Cosmology parameter, amplitude of the (linear) power spectrum on the
228+
scale of 8 Mpc/h.
229+
ns : float
230+
Cosmology parameter, spectral index of scalar perturbation power spectrum.
231+
232+
Returns
233+
-------
234+
concentration : float or array_like
235+
Halo concentration(s); has the same dimensions as mass.
236+
237+
"""
238+
from colossus.cosmology.cosmology import fromAstropy
239+
from colossus.halo import concentration
240+
241+
fromAstropy(cosmology, sigma8=sigma8, ns=ns)
242+
243+
c = concentration.concentration(mass, mdef, redshift, model)
244+
245+
return c
246+
247+
def radius(mass, concentration, redshift, mdef, Delta, cosmology, sigma8, ns)
248+
"""Calculate the scale radius and the spherical overdensity radius of halo by assuming
249+
the NFW model.
250+
251+
This function calculates the scale radius and any spherical overdensity radius
252+
for NFW dark matter halo.
253+
254+
Parameters
255+
----------
256+
mass : float
257+
A spherical overdensity halo mass in units of solar mass/h, corresponding
258+
to the mass definition, mdef.
259+
concentration : float
260+
The concentration corresponding to the given halo mass and mass definition.
261+
redshift : float
262+
The halo redshift value.
263+
mdef : str
264+
Halo mass definition for spherical overdensities used by colossus.
265+
Delta : str
266+
The mass definition for which the spherical overdensity radius is computed.
267+
cosmology : astropy.cosmology.Cosmology
268+
Astropy cosmology object
269+
sigma8 : float
270+
Cosmology parameter, amplitude of the (linear) power spectrum on the
271+
scale of 8 Mpc/h.
272+
ns : float
273+
Cosmology parameter, spectral index of scalar perturbation power spectrum.
274+
275+
Returns
276+
-------
277+
rs : float
278+
The scale radius in physical kpc/h.
279+
RDelta : float
280+
Spherical overdensity radius of a given mass definition Delta.
281+
282+
"""
283+
from colossus.cosmology.cosmology import fromAstropy
284+
from colossus.halo import profile_nfw
285+
286+
fromAstropy(cosmology, sigma8=sigma8, ns=ns)
287+
288+
prof = profile_nfw.NFWProfile(M = mass, c = concentration, z = redshift, mdef = mdef)
289+
rs = prof.par['rs']
290+
RDelta = prof.RDelta(redshift, Delta)
291+
292+
return rs, RDelta
293+
294+
295+
def Delta_Sigma(mass, concentration, redshift, mdef, radius, cosmology, sigma8, ns):
296+
"""The excess surface density at given radius by assuming the NFW model.
297+
298+
This function uses Colossus routines to compute the excess surface density profile,
299+
which is defined as Delta_Sigma(R) = Sigma(<R) − Sigma(R).
300+
301+
Parameters
302+
----------
303+
mass : float
304+
A spherical overdensity halo mass in units of solar mass/h, corresponding
305+
to the mass definition, mdef.
306+
concentration : float
307+
The concentration corresponding to the given halo mass and mass definition.
308+
redshift : float
309+
Halo redshift
310+
mdef : str
311+
Halo mass definition for spherical overdensities used by colossus.
312+
radius : float or array_like
313+
Radius in physical kpc/h.
314+
cosmology : astropy.cosmology.Cosmology
315+
Astropy cosmology object
316+
sigma8 : float
317+
Cosmology parameter, amplitude of the (linear) power spectrum on the
318+
scale of 8 Mpc/h.
319+
ns : float
320+
Cosmology parameter, spectral index of scalar perturbation power spectrum.
321+
322+
Returns
323+
-------
324+
DeltaSigma: float or array_like
325+
The excess surface density at the given radius, in units of h physical Msun/kpc^2;
326+
has the same dimensions as radius.
327+
"""
328+
from colossus.cosmology.cosmology import fromAstropy
329+
from colossus.halo import profile_nfw
330+
331+
fromAstropy(cosmology, sigma8=sigma8, ns=ns)
332+
333+
prof = profile_nfw.NFWProfile(M = mass, c = concentration, z = redshift, mdef = mdef)
334+
deltaSigma = prof.deltaSigma(radius)
335+
336+
return deltaSigma

0 commit comments

Comments
 (0)