Skip to content

Commit

Permalink
HOD-HOD-HOD (#793)
Browse files Browse the repository at this point in the history
* basic and specific HOD

* split. code real

* almost done implementing

* unit tested

* agrees with benchmark

* benchmarked

* flake

* simplified

* fc

* prof2pt

* benchmark credit

* bad docs, bad norm
  • Loading branch information
damonge committed Jul 14, 2020
1 parent dfb2401 commit 0c013ca
Show file tree
Hide file tree
Showing 11 changed files with 1,215 additions and 6 deletions.
19 changes: 19 additions & 0 deletions benchmarks/data/cl_hod.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
2.000000000000000000e+00 4.153496585883831305e-02
3.000000000000000000e+00 2.996667793508545757e-02
5.000000000000000000e+00 1.801723081692521017e-02
7.000000000000000000e+00 1.206452848723018473e-02
1.000000000000000000e+01 7.530022914115463810e-03
1.400000000000000000e+01 4.744129065869833600e-03
1.900000000000000000e+01 3.122333143009977698e-03
2.700000000000000000e+01 1.966991839553884278e-03
3.700000000000000000e+01 1.334006560994543998e-03
5.200000000000000000e+01 8.977132411462818325e-04
7.300000000000000000e+01 6.112391887704792491e-04
1.010000000000000000e+02 4.215023445623956823e-04
1.400000000000000000e+02 2.864439067856073716e-04
1.940000000000000000e+02 1.916095446848516939e-04
2.700000000000000000e+02 1.254309477364139213e-04
3.740000000000000000e+02 8.153479239316625533e-05
5.190000000000000000e+02 5.237945805414662246e-05
7.210000000000000000e+02 3.334292449977670778e-05
1.000000000000000000e+03 2.108463449661604144e-05
56 changes: 56 additions & 0 deletions benchmarks/data/codes/hod_bm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import pysz_gal.pysz_gal as szgal
import numpy as np
from scipy.integrate import simps


# Set N(z)
def _nz_2mrs(z):
# From 1706.05422
m = 1.31
beta = 1.64
x = z / 0.0266
return x**m * np.exp(-x**beta)
z1 = 1e-5
z2 = 0.1
z_arr = np.linspace(z1, z2, 10024)
dndz = _nz_2mrs(z_arr)
dndz /= simps(dndz, z_arr)

# Set things up
pyszgal_cl = szgal.tsz_gal_cl()
ell = np.unique(np.geomspace(2, 1000, 20).astype(int)).astype(float)

# Set params
h0 = 0.67
Omb = 0.05
Omc = 0.25
As = 2E-9
ns = 0.9645
mnu = 0.00001
ombh2 = Omb*h0**2
omch2 = Omc*h0**2
bias = 1.55
lMcut = 11.8
Mcut = 10**lMcut
lM1 = 11.73
M1 = 10**lM1
kappa = 1.0
sigma_Ncen = 0.15
alp_Nsat = 0.77
rmax = 4.39
rgs = 1.17
pars = {'h0':h0, 'obh2':ombh2,'och2':omch2,\
'As':As,'ns':ns,'mnu':mnu,\
'mass_bias':bias,\
'Mcut':Mcut,'M1':M1,'kappa':kappa,'sigma_Ncen':sigma_Ncen,'alp_Nsat':alp_Nsat,\
'rmax':rmax,'rgs':rgs,\
'flag_nu':True,'flag_tll':False}

# Run pysz_gal
gg, gy, tll, ng, tmp, ks, zs, pks = pyszgal_cl.get_tsz_cl(ell, pars, dndz,\
z1, z2, z1, z2, 101, 1001)
# Save benchmark data
np.savetxt("../k_hod.txt", ks)
np.savetxt("../z_hod.txt", zs)
np.savetxt("../pk_hod.txt", pks)
np.savetxt("../cl_hod.txt", np.transpose([ell, gg[0]+gg[1]]))
12 changes: 12 additions & 0 deletions benchmarks/data/codes/hod_cl_benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Clone and install
git clone git@github.com:damonge/pysz_gal.git
cd pysz_gal/pysz_gal/source
make clean
make
cd ../../
python setup.py install --user
cd ..
python hod_bm.py

0 comments on commit 0c013ca

Please sign in to comment.