Skip to content

Commit

Permalink
IA profile v3 (#1074)
Browse files Browse the repository at this point in the history
* IA profile

---------

Co-authored-by: Nick Koukoufilippas <nikfilippas@gmail.com>
Co-authored-by: Christos Georgiou <chr.p.georgiou@gmail.com>
  • Loading branch information
3 people committed May 9, 2023
1 parent 7f019f5 commit 0264d66
Show file tree
Hide file tree
Showing 19 changed files with 1,857 additions and 111 deletions.
202 changes: 202 additions & 0 deletions benchmarks/data/IA_halomodel_Cell_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
2.000000000000000000e+00,-4.079651998902341439e-15,8.134286151117415450e-17
3.000000000000000000e+00,-8.172952533397098487e-15,1.517095083397727495e-16
4.000000000000000000e+00,-1.249923546868336983e-14,2.192451471052644051e-16
5.000000000000000000e+00,-1.712445168829961240e-14,2.869448153345468925e-16
6.000000000000000000e+00,-2.206347568893245043e-14,3.561402686530901197e-16
7.000000000000000000e+00,-2.731380216750170692e-14,4.275498272758714005e-16
8.000000000000000000e+00,-3.286636517643174006e-14,5.016277908675524743e-16
9.000000000000000000e+00,-3.870996900876139761e-14,5.786995233295773726e-16
1.000000000000000000e+01,-4.483300208486074536e-14,6.590216069858594261e-16
1.100000000000000000e+01,-5.122621268800844029e-14,7.428576367755978431e-16
1.200000000000000000e+01,-5.787203271617031113e-14,8.303026636553387779e-16
1.300000000000000000e+01,-6.476327726164509684e-14,9.215888338450745671e-16
1.400000000000000000e+01,-7.188945463047338186e-14,1.016883619365015100e-15
1.500000000000000000e+01,-7.924075796959977555e-14,1.116351548537820283e-15
1.600000000000000000e+01,-8.680804947165901615e-14,1.220145922618705285e-15
1.700000000000000000e+01,-9.458246153382818689e-14,1.328419335215853959e-15
1.800000000000000000e+01,-1.025555772194094571e-13,1.441319027564097411e-15
1.900000000000000000e+01,-1.107197405964609269e-13,1.558987869201869491e-15
2.000000000000000000e+01,-1.190673892106846548e-13,1.681568245908514685e-15
2.100000000000000000e+01,-1.275909044470865554e-13,1.809222382456231440e-15
2.200000000000000000e+01,-1.362726546532083317e-13,1.942070553568652435e-15
2.300000000000000000e+01,-1.451402135386784844e-13,2.080248383289424276e-15
2.400000000000000000e+01,-1.541529079210552041e-13,2.223886140194020180e-15
2.500000000000000000e+01,-1.633165572325929873e-13,2.373117300909110412e-15
2.600000000000000000e+01,-1.726253832041087821e-13,2.528073681818785284e-15
2.700000000000000000e+01,-1.820738889892435986e-13,2.688859701643085768e-15
2.800000000000000000e+01,-1.916569022099531747e-13,2.855676521508774702e-15
2.900000000000000000e+01,-2.013695591243136382e-13,3.028611462746234111e-15
3.000000000000000000e+01,-2.112068482889466509e-13,3.207788944550052869e-15
3.100000000000000000e+01,-2.211642897362943374e-13,3.393333806936108385e-15
3.300000000000000000e+01,-2.414218374878080179e-13,3.784016432904843175e-15
3.400000000000000000e+01,-2.517136684804680060e-13,3.989386078378396068e-15
3.500000000000000000e+01,-2.621088982752837438e-13,4.201604943481879958e-15
3.600000000000000000e+01,-2.726036807467849714e-13,4.420785110080883376e-15
3.700000000000000000e+01,-2.831943946678167066e-13,4.647042071322206111e-15
3.900000000000000000e+01,-3.046494990300209562e-13,5.121229461712980584e-15
4.000000000000000000e+01,-3.155076622435622458e-13,5.369384649467147773e-15
4.100000000000000000e+01,-3.264474170142805450e-13,5.625055312016182529e-15
4.300000000000000000e+01,-3.485631086352399773e-13,6.159366167939223589e-15
4.400000000000000000e+01,-3.597326960510400753e-13,6.438215371560051294e-15
4.600000000000000000e+01,-3.822813184460174527e-13,7.019808269847963122e-15
4.700000000000000000e+01,-3.936552563583777742e-13,7.322753043082214023e-15
4.900000000000000000e+01,-4.165890116495036686e-13,7.953418642701433678e-15
5.100000000000000000e+01,-4.397556195113196698e-13,8.617743399276915565e-15
5.200000000000000000e+01,-4.514202607663551077e-13,8.962760157408483547e-15
5.400000000000000000e+01,-4.749018226587493567e-13,9.678953900409205931e-15
5.600000000000000000e+01,-4.985720756270194150e-13,1.043059851492934942e-14
5.800000000000000000e+01,-5.224182783086838006e-13,1.121838130098106967e-14
6.000000000000000000e+01,-5.464229088798122152e-13,1.204294796228835548e-14
6.200000000000000000e+01,-5.705731468696846782e-13,1.290496131483997436e-14
6.400000000000000000e+01,-5.948558009784445529e-13,1.380496156003689336e-14
6.600000000000000000e+01,-6.192588834185185884e-13,1.474360646326184796e-14
6.800000000000000000e+01,-6.437704776572691128e-13,1.572145714745535185e-14
7.100000000000000000e+01,-6.807177527203495117e-13,1.726292447154225074e-14
7.300000000000000000e+01,-7.054550153352660111e-13,1.834114497601244338e-14
7.600000000000000000e+01,-7.426940931228936772e-13,2.003561413133709855e-14
7.800000000000000000e+01,-7.675967033469608675e-13,2.121737919416328935e-14
8.100000000000000000e+01,-8.050445057990571647e-13,2.306939882332366104e-14
8.400000000000000000e+01,-8.425813288958908201e-13,2.501782830543050902e-14
8.700000000000000000e+01,-8.801824479505058371e-13,2.706447524963081705e-14
9.000000000000000000e+01,-9.178254024426093260e-13,2.921034610141617587e-14
9.300000000000000000e+01,-9.554887783574652195e-13,3.145674670291414174e-14
9.600000000000000000e+01,-9.931533322378093217e-13,3.380492557128269420e-14
9.900000000000000000e+01,-1.030801818956520756e-12,3.625601239091321851e-14
1.020000000000000000e+02,-1.068416932904077337e-12,3.881109149837708894e-14
1.060000000000000000e+02,-1.118491342327596477e-12,4.238134791581856572e-14
1.100000000000000000e+02,-1.168445573638790296e-12,4.614037551055833974e-14
1.130000000000000000e+02,-1.205814715514027627e-12,4.908489770498716222e-14
1.170000000000000000e+02,-1.255485764103924324e-12,5.317921067617426172e-14
1.210000000000000000e+02,-1.304961278237785709e-12,5.746749711282362784e-14
1.250000000000000000e+02,-1.354214750122346049e-12,6.195174256143570703e-14
1.300000000000000000e+02,-1.415438518984792701e-12,6.783423475956070009e-14
1.340000000000000000e+02,-1.464119327513347538e-12,7.276364886348263786e-14
1.390000000000000000e+02,-1.524570761805862858e-12,7.920660747150676644e-14
1.430000000000000000e+02,-1.572598840601314100e-12,8.458737258766174416e-14
1.480000000000000000e+02,-1.632180183649281313e-12,9.159738837973951408e-14
1.530000000000000000e+02,-1.691248234693454013e-12,9.892471145606698274e-14
1.580000000000000000e+02,-1.749780669246596169e-12,1.065704808747421055e-13
1.640000000000000000e+02,-1.819285931175706306e-12,1.161672856948044279e-13
1.690000000000000000e+02,-1.876579412622195873e-12,1.245171253480524137e-13
1.750000000000000000e+02,-1.944559064176009901e-12,1.349606522144464185e-13
1.810000000000000000e+02,-2.011678785161256146e-12,1.458674609755622604e-13
1.870000000000000000e+02,-2.077924846975286124e-12,1.572371644230225080e-13
1.940000000000000000e+02,-2.154093168008691251e-12,1.710873939029482560e-13
2.000000000000000000e+02,-2.218406264055216579e-12,1.834606260269557772e-13
2.070000000000000000e+02,-2.292296026584760887e-12,1.984797356705999340e-13
2.140000000000000000e+02,-2.364949760283773314e-12,2.141261753376659966e-13
2.210000000000000000e+02,-2.436363049511740159e-12,2.303986269616023495e-13
2.290000000000000000e+02,-2.516459952083866210e-12,2.497582168305438673e-13
2.370000000000000000e+02,-2.594942234510131368e-12,2.699276409358224988e-13
2.450000000000000000e+02,-2.671819408204307578e-12,2.909025046316036481e-13
2.530000000000000000e+02,-2.747094547389152588e-12,3.126776472279824549e-13
2.620000000000000000e+02,-2.829891597121182344e-12,3.381234756459326012e-13
2.710000000000000000e+02,-2.910705463830252262e-12,3.645671092381626758e-13
2.800000000000000000e+02,-2.989654095370093440e-12,3.919981676769924053e-13
2.890000000000000000e+02,-3.065013422842934339e-12,4.204074895573659384e-13
2.990000000000000000e+02,-3.149764124231983055e-12,4.531093522053028459e-13
3.100000000000000000e+02,-3.238704492174993882e-12,4.904449056503282693e-13
3.200000000000000000e+02,-3.317190269768800029e-12,5.256100517551173647e-13
3.310000000000000000e+02,-3.400988083004530388e-12,5.656182849976855368e-13
3.420000000000000000e+02,-3.482183534419393237e-12,6.069989449726826383e-13
3.540000000000000000e+02,-3.567875258016314777e-12,6.536789851662562322e-13
3.660000000000000000e+02,-3.650630169041768233e-12,7.019360413238035066e-13
3.780000000000000000e+02,-3.730531282915146876e-12,7.517249281356040770e-13
3.910000000000000000e+02,-3.813974951801212223e-12,8.074189143355874753e-13
4.040000000000000000e+02,-3.894286540020725056e-12,8.648439956960686710e-13
4.180000000000000000e+02,-3.977380219553446514e-12,9.286002410174537201e-13
4.320000000000000000e+02,-4.057078626788093398e-12,9.942975470771430818e-13
4.470000000000000000e+02,-4.138843587174723153e-12,1.066793845945789042e-12
4.620000000000000000e+02,-4.217002639219832704e-12,1.141409269030674400e-12
4.780000000000000000e+02,-4.296551884680656849e-12,1.223276739844887348e-12
4.940000000000000000e+02,-4.372319997643474004e-12,1.307431183699737883e-12
5.110000000000000000e+02,-4.448865036497765037e-12,1.399277907242108304e-12
5.290000000000000000e+02,-4.525663744793395310e-12,1.499174141240541353e-12
5.470000000000000000e+02,-4.598300760356365422e-12,1.601720987413104161e-12
5.650000000000000000e+02,-4.666975663771573998e-12,1.706787389802610864e-12
5.840000000000000000e+02,-4.735390547742360358e-12,1.820375653704452721e-12
6.040000000000000000e+02,-4.803109352080686949e-12,1.942797506025896795e-12
6.250000000000000000e+02,-4.869724983685555990e-12,2.074371994877860680e-12
6.460000000000000000e+02,-4.931980096110460455e-12,2.208927804072139778e-12
6.680000000000000000e+02,-4.992798687241655440e-12,2.352954300025573981e-12
6.910000000000000000e+02,-5.051830887472452220e-12,2.506735183478639166e-12
7.140000000000000000e+02,-5.106492977614249078e-12,2.663638521244757644e-12
7.380000000000000000e+02,-5.159109640882601643e-12,2.830541550770633709e-12
7.630000000000000000e+02,-5.209560207645890897e-12,3.007675776705366067e-12
7.890000000000000000e+02,-5.257467366141872981e-12,3.195261423870612781e-12
8.160000000000000000e+02,-5.302673696502380858e-12,3.393490266542295604e-12
8.440000000000000000e+02,-5.345005735714705964e-12,3.602536400893280399e-12
8.730000000000000000e+02,-5.384300976964604589e-12,3.822559794252272210e-12
9.020000000000000000e+02,-5.419299324063477415e-12,4.045913550016527157e-12
9.330000000000000000e+02,-5.452303547342414631e-12,4.288122122238786018e-12
9.650000000000000000e+02,-5.481953561759543820e-12,4.541611551269240955e-12
9.970000000000000000e+02,-5.507458131978954503e-12,4.798349057611240109e-12
1.031000000000000000e+03,-5.530382055729775979e-12,5.074436344343879777e-12
1.066000000000000000e+03,-5.549819585044440881e-12,5.361868526559449529e-12
1.103000000000000000e+03,-5.566191944488584889e-12,5.668953375172249782e-12
1.140000000000000000e+03,-5.578643405748100382e-12,5.979064431337473647e-12
1.179000000000000000e+03,-5.587888964073975405e-12,6.308841824157219933e-12
1.219000000000000000e+03,-5.593600663827925276e-12,6.649825473549436572e-12
1.260000000000000000e+03,-5.595850784614495020e-12,7.001853935633438219e-12
1.303000000000000000e+03,-5.594665603065433925e-12,7.373411490483139468e-12
1.347000000000000000e+03,-5.590058884093010145e-12,7.756147876668747433e-12
1.393000000000000000e+03,-5.581929146389730372e-12,8.157274222248010544e-12
1.441000000000000000e+03,-5.569472451217876329e-12,8.577916527386016491e-12
1.489000000000000000e+03,-5.555553751228991910e-12,8.999755915174165542e-12
1.540000000000000000e+03,-5.537163515231611112e-12,9.448873111512816974e-12
1.592000000000000000e+03,-5.515618722425288817e-12,9.907284111410270443e-12
1.646000000000000000e+03,-5.490741575931961321e-12,1.038339911377441336e-11
1.702000000000000000e+03,-5.462535761379693967e-12,1.087679067982485417e-11
1.760000000000000000e+03,-5.431057122441102679e-12,1.138687723828037995e-11
1.820000000000000000e+03,-5.396405919814033251e-12,1.191311104164092644e-11
1.882000000000000000e+03,-5.358667477974846407e-12,1.245486681126266139e-11
1.946000000000000000e+03,-5.317968052889219795e-12,1.301142498515237373e-11
2.012000000000000000e+03,-5.274444041138805681e-12,1.358209057694676217e-11
2.080000000000000000e+03,-5.228236070691098758e-12,1.416607419731596051e-11
2.151000000000000000e+03,-5.178783512989018313e-12,1.477099771438617199e-11
2.224000000000000000e+03,-5.126802496455116833e-12,1.538738475680390196e-11
2.300000000000000000e+03,-5.072021664223424527e-12,1.602260588927883310e-11
2.378000000000000000e+03,-5.015018858370622214e-12,1.666726976075070949e-11
2.458000000000000000e+03,-4.956068600510035511e-12,1.732021620403059921e-11
2.542000000000000000e+03,-4.894001093587517951e-12,1.799658363600670486e-11
2.628000000000000000e+03,-4.830056965360198690e-12,1.867886058064176857e-11
2.718000000000000000e+03,-4.763333645838512648e-12,1.938135010741027416e-11
2.810000000000000000e+03,-4.695368445797252755e-12,2.008701929556604713e-11
2.905000000000000000e+03,-4.625586920707398440e-12,2.080220365443410737e-11
3.004000000000000000e+03,-4.553440086471040312e-12,2.153261189159434668e-11
3.106000000000000000e+03,-4.479852729710304973e-12,2.226904509538020507e-11
3.212000000000000000e+03,-4.404301987568022338e-12,2.301690398406824098e-11
3.321000000000000000e+03,-4.327745164821078943e-12,2.376725263458541299e-11
3.434000000000000000e+03,-4.249636685410589999e-12,2.452508009254000541e-11
3.550000000000000000e+03,-4.170867138681097130e-12,2.528178782417511616e-11
3.671000000000000000e+03,-4.090291202803881176e-12,2.604825214895918448e-11
3.796000000000000000e+03,-4.008786301913264527e-12,2.681484827385121456e-11
3.924000000000000000e+03,-3.927196595249438859e-12,2.757475456064829402e-11
4.058000000000000000e+03,-3.843803330600006022e-12,2.834354521326080744e-11
4.196000000000000000e+03,-3.760112171900191811e-12,2.910795746706434066e-11
4.338000000000000000e+03,-3.676299747461585712e-12,2.986316790989512613e-11
4.486000000000000000e+03,-3.591402700603566155e-12,3.061873922157147692e-11
4.638000000000000000e+03,-3.506738072317368616e-12,3.136152915050191231e-11
4.795000000000000000e+03,-3.422157591706604641e-12,3.209479069296607492e-11
4.958000000000000000e+03,-3.336920025005906078e-12,3.282011036232419322e-11
5.127000000000000000e+03,-3.251396204281779965e-12,3.353467587814712969e-11
5.301000000000000000e+03,-3.166463693280382880e-12,3.422557688646699266e-11
5.481000000000000000e+03,-3.081598466453485541e-12,3.491284719437679491e-11
5.667000000000000000e+03,-2.997169027809678574e-12,3.557549418326781471e-11
5.860000000000000000e+03,-2.912891267195486347e-12,3.622045819689678498e-11
6.059000000000000000e+03,-2.829382373741506458e-12,3.684181487233451437e-11
6.264000000000000000e+03,-2.746833846771783186e-12,3.743745956405839742e-11
6.477000000000000000e+03,-2.664431539225258708e-12,3.801068436398037567e-11
6.697000000000000000e+03,-2.582918320980622681e-12,3.855606184011831972e-11
6.925000000000000000e+03,-2.502024650113787149e-12,3.907369441446331824e-11
7.160000000000000000e+03,-2.422290438107478151e-12,3.955895113268144941e-11
7.403000000000000000e+03,-2.343514462563713232e-12,4.001141856149136668e-11
7.655000000000000000e+03,-2.265550844897752739e-12,4.043251480419743158e-11
7.915000000000000000e+03,-2.188914178375178210e-12,4.081663488514359096e-11
8.183000000000000000e+03,-2.113618847195281946e-12,4.116289720709728258e-11
8.461000000000000000e+03,-2.039277276010969212e-12,4.147210565018076379e-11
8.749000000000000000e+03,-1.966060857728687627e-12,4.174220341262375351e-11
9.046000000000000000e+03,-1.894309998600195766e-12,4.197095717322017783e-11
9.353000000000000000e+03,-1.823994845414696091e-12,4.215868855926698229e-11
9.671000000000000000e+03,-1.754899724113782569e-12,4.230281335154993197e-11
1.000000000000000000e+04,-1.687226400991716664e-12,4.240402710039709693e-11
30 changes: 30 additions & 0 deletions benchmarks/data/IA_halomodel_norm_term.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1.000000000000000000e+10 7.699922933478342557e-02
1.610262027560942459e+10 1.240359718918154081e-01
2.592943797404666901e+10 1.997774523315629658e-01
4.175318936560408783e+10 3.217410821949391875e-01
6.723357536499334717e+10 5.181344841074294605e-01
1.082636733874056244e+11 8.343793216706293370e-01
1.743328822199987183e+11 1.343616375010823205e+00
2.807216203941181641e+11 2.163621465031568825e+00
4.520353656360240479e+11 3.484044523898653711e+00
7.278953843983161621e+11 5.610271635908201660e+00
1.172102297533479248e+12 9.034054416347705896e+00
1.887391822135099609e+12 1.454724181830650309e+01
3.039195382313194824e+12 2.342491814250802307e+01
4.893900918477499023e+12 3.772030322034662930e+01
7.880462815669904297e+12 6.073961898055123498e+01
1.268961003167923438e+13 9.780674904964409677e+01
2.043359717856939453e+13 1.574945410705660720e+02
3.290344562312671094e+13 2.536075260708124688e+02
5.298316906283702344e+13 4.083746161722419288e+02
8.531678524172814062e+13 6.575901844786785659e+02
1.373823795883260938e+14 1.058892550799549326e+03
2.212216291070450312e+14 1.705094512856403071e+03
3.562247890262451250e+14 2.745648994491931717e+03
5.736152510448681250e+14 4.421214363877966207e+03
9.236708571873846250e+14 7.119313652896409621e+03
1.487352107293511750e+15 1.146396048459201484e+04
2.395026619987491000e+15 1.845998030083440608e+04
3.856620421163472000e+15 2.972540535499328689e+04
6.210169418915604000e+15 4.786569154403894208e+04
1.000000000000000000e+16 7.707630556334754510e+04
56 changes: 56 additions & 0 deletions benchmarks/data/codes/IAhalo_normalisation_benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Taken from github.com/c-d-leonard/IA_GGL/blob/CCL_IAhalo_bm/
# Written by Danielle Leonard.
# This is script is intended to provide code to benchmark the
# integration over the halo mass function and HOD quantities for
# the IA halo model in CCL

import numpy as np
import scipy.integrate
import pyccl as ccl


def normalisation(Mhalo, cosmo, conc, z):
""" Returns the 'normalisation factor' that goes into the IA halo model
power spectrum: satelite fraction * Nsat / tot_ns as a function of Mhalo.
Mhalo is the vector of halo masses over which to integrate in units of Msol
cosmo is a pyccl cosmology object
conc is a concentration relation object
z is the redshift at which to calculate this
"""

# Get the halo mass function
HMF_setup = ccl.halos.MassFuncTinker10(cosmo)
HMF = HMF_setup.get_mass_function(cosmo, Mhalo, 1. / (1. + z))

# Get HOD quantities we need
HODHProf = ccl.halos.HaloProfileHOD(conc)
Ncen_lens = HODHProf._Nc(Mhalo, 1. / (1. + z))
Nsat_lens = HODHProf._Ns(Mhalo, 1. / (1. + z))

# Get total number of satellite galaxies
tot_ns = scipy.integrate.simps(Ncen_lens * Nsat_lens * HMF, np.log10(Mhalo))
tot_nc = scipy.integrate.simps((Ncen_lens) * HMF, np.log10(Mhalo))

tot_all = tot_ns + tot_nc

# Fraction of satellites:
f_s = tot_ns / tot_all

return f_s / tot_ns * Nsat_lens


if (__name__ == "__main__"):
Mhalo = np.logspace(10., 16, 30) # Units Msol

z = 0.0

cosmo = ccl.Cosmology(Omega_c=0.25, Omega_b=0.05, Omega_k=0, sigma8=0.81, n_s=0.96, h=1.)

concentration = ccl.halos.ConcentrationDuffy08()

norm_term = normalisation(Mhalo, cosmo, concentration, z)

save = np.column_stack((Mhalo, norm_term))
np.savetxt('../IA_halomodel_norm_term.dat', save)


0 comments on commit 0264d66

Please sign in to comment.