Skip to content

Commit 1e08d4e

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

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

skypy/halos/tests/test_colossus.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_colossus_mass_sampler():
1111
from astropy.cosmology import WMAP9
1212
from colossus.cosmology.cosmology import fromAstropy
1313
from colossus.lss import mass_function
14-
from skypy.halos.mass import colossus_mass_sampler
14+
from skypy.halos._colossus import colossus_mass_sampler
1515
m_min, m_max, size = 1e+12, 1e+16, 100
1616
sample = colossus_mass_sampler(redshift=0.1, model='despali16',
1717
mdef='500c', m_min=m_min, m_max=m_max,
@@ -105,3 +105,53 @@ def test_colossus_mf():
105105
assert np.all(z_halo <= np.max(z))
106106
assert np.all(m_halo >= m_min)
107107
assert np.all(m_halo <= m_max)
108+
109+
@pytest.mark.skipif(not HAS_COLOSSUS, reason='test requires colossus')
110+
@pytest.mark.flaky
111+
def test_colossus_concentration():
112+
from skypy.halos._colossus import concentration
113+
from astropy.cosmology import Planck15
114+
from colossus.cosmology.cosmology import fromAstropy
115+
116+
mass=np.logspace(np.log10(1e+14), np.log10(1e+15), 10)
117+
model, mdef = 'diemer19', '200c'
118+
redshift = 0.5
119+
cosmo = Planck15
120+
sigma8, ns = 0.82, 0.96
121+
c = concentration(mass, mdef, redshift, model, cosmo, sigma8, ns)
122+
123+
assert len(mass) == len(c)
124+
125+
@pytest.mark.skipif(not HAS_COLOSSUS, reason='test requires colossus')
126+
@pytest.mark.flaky
127+
def test_colossus_radius():
128+
from skypy.halos._colossus import radius
129+
from astropy.cosmology import Planck15
130+
from colossus.cosmology.cosmology import fromAstropy
131+
132+
mass, c, redshift = 1e+15, 3, 0.5
133+
Delta, mdef = '500c', '200c'
134+
cosmo = Planck15
135+
sigma8, ns = 0.82, 0.96
136+
137+
rs, RDelta = radius(mass, c, redshift, mdef, Delta, cosmo, sigma8, ns)
138+
139+
assert rs > 0
140+
assert RDelta > 0
141+
142+
@pytest.mark.skipif(not HAS_COLOSSUS, reason='test requires colossus')
143+
@pytest.mark.flaky
144+
def test_colossus_Delta_Sigma():
145+
from skypy.halos._colossus import Delta_Sigma
146+
from astropy.cosmology import Planck15
147+
from colossus.cosmology.cosmology import fromAstropy
148+
149+
mass, c, redshift = 1e+15, 3, 0.5
150+
mdef = '200c'
151+
cosmo = Planck15
152+
sigma8, ns = 0.82, 0.96
153+
radius = np.logspace(np.log10(300), np.log10(3000), 10)
154+
155+
DeltaSigma=delta_Sigma(mass, c, redshift, mdef, radius, cosmo, sigma8, ns)
156+
157+
assert len(DeltaSigma) == len(radius)

0 commit comments

Comments
 (0)