From ca1b0261f0356495a75b32287b15596c6b61b434 Mon Sep 17 00:00:00 2001 From: David Alonso Date: Wed, 2 Oct 2024 16:08:18 +0100 Subject: [PATCH] Bug in Despali16 (#1197) * Fixed bug in despali16 MF implementation --- benchmarks/data/codes/hmf_bm.py | 5 +++-- benchmarks/data/hbf_bhattacharya11.txt | 18 +++++++++--------- benchmarks/data/hbf_sheth01.txt | 18 +++++++++--------- benchmarks/data/hbf_tinker10.txt | 18 +++++++++--------- benchmarks/data/hmf_angulo12.txt | 18 +++++++++--------- benchmarks/data/hmf_bocquet16.txt | 18 +++++++++--------- benchmarks/data/hmf_despali16.txt | 18 +++++++++--------- benchmarks/data/hmf_despali16_m200c.txt | 10 ++++++++++ benchmarks/data/hmf_jenkins01.txt | 18 +++++++++--------- benchmarks/data/hmf_press74.txt | 18 +++++++++--------- benchmarks/data/hmf_sheth99.txt | 18 +++++++++--------- benchmarks/data/hmf_tinker08.txt | 18 +++++++++--------- benchmarks/data/hmf_watson13.txt | 18 +++++++++--------- benchmarks/test_hmf.py | 12 ++++++++++++ pyccl/halos/hmfunc/despali16.py | 2 +- 15 files changed, 125 insertions(+), 102 deletions(-) create mode 100644 benchmarks/data/hmf_despali16_m200c.txt diff --git a/benchmarks/data/codes/hmf_bm.py b/benchmarks/data/codes/hmf_bm.py index a47e5c4be..4ed4303f8 100644 --- a/benchmarks/data/codes/hmf_bm.py +++ b/benchmarks/data/codes/hmf_bm.py @@ -6,7 +6,7 @@ my_cosmo = {'flat': True, 'H0': 100 * h, 'Om0': 0.30, 'Ob0': 0.05, 'sigma8': 0.8, 'ns': 0.96} cosmo_C = cosmology.setCosmology('my_cosmo', my_cosmo) -def get_mfs(model, mdef): +def get_mfs(model, mdef, extra=''): m_arr=np.geomspace(1E11,1E15,9) z_arr=np.array([0., 0.5, 1.]) d_out = [] @@ -17,7 +17,7 @@ def get_mfs(model, mdef): mdef = mdef, model = model, q_out = 'dndlnM') * normfac) - np.savetxt("../hmf_" + model + ".txt", + np.savetxt("../hmf_" + model + extra + ".txt", np.transpose(d_out), header = 'M nM(z=0) nM(z=0.5) nM(z=1)') @@ -26,6 +26,7 @@ def get_mfs(model, mdef): get_mfs('sheth99', 'fof') get_mfs('jenkins01', 'fof') get_mfs('despali16', 'vir') +get_mfs('despali16', '200c', extra='_m200c') get_mfs('bocquet16', '200c') get_mfs('watson13', '200m') get_mfs('angulo12', 'fof') diff --git a/benchmarks/data/hbf_bhattacharya11.txt b/benchmarks/data/hbf_bhattacharya11.txt index 2954c6db5..9183f5aa8 100644 --- a/benchmarks/data/hbf_bhattacharya11.txt +++ b/benchmarks/data/hbf_bhattacharya11.txt @@ -1,10 +1,10 @@ # M bh(z=0) bh(z=0.5) bh(z=1) -1.000000000000000000e+11 8.056472272200043694e-01 8.279273354140516128e-01 8.976058669476857377e-01 -3.162277660168379517e+11 8.133532649664526604e-01 8.634045293684119438e-01 9.811911737720240279e-01 -1.000000000000000000e+12 8.368410437256541545e-01 9.322943414763796843e-01 1.124572069374191186e+00 -3.162277660168379395e+12 8.904273601974718177e-01 1.060020398661613239e+00 1.368721179437731417e+00 -1.000000000000000000e+13 1.000874328580656281e+00 1.292279275657826743e+00 1.786059589472553721e+00 -3.162277660168379297e+13 1.218405856402012821e+00 1.712512356857917695e+00 2.507751343553659140e+00 -1.000000000000000000e+14 1.640056418908187652e+00 2.480131310416751056e+00 3.784592294932728418e+00 -3.162277660168379375e+14 2.464865288622618333e+00 3.922380902877607767e+00 6.133870381671594707e+00 -1.000000000000000000e+15 4.121944855112288586e+00 6.747987127862933754e+00 1.068017313029656634e+01 +1.000000000000000000e+11 8.056494960116299398e-01 8.279472422087663652e-01 8.976573647824390711e-01 +3.162277660168379517e+11 8.133573099885211821e-01 8.634188151666986055e-01 9.812227297904290158e-01 +1.000000000000000000e+12 8.368399672571407155e-01 9.322915176871943155e-01 1.124566441004950290e+00 +3.162277660168379395e+12 8.904173998277619129e-01 1.059998143437133056e+00 1.368679943538992694e+00 +1.000000000000000000e+13 1.000864639595142602e+00 1.292259758747396514e+00 1.786025314645679263e+00 +3.162277660168379297e+13 1.218442638710317327e+00 1.712581304528613346e+00 2.507867821658908980e+00 +1.000000000000000000e+14 1.640237254579982595e+00 2.480453746803513049e+00 3.785122739299591199e+00 +3.162277660168379375e+14 2.465168751945624681e+00 3.922904483639784168e+00 6.134717539879753545e+00 +1.000000000000000000e+15 4.121544227645896896e+00 6.747309155584129137e+00 1.067908616237032327e+01 diff --git a/benchmarks/data/hbf_sheth01.txt b/benchmarks/data/hbf_sheth01.txt index d1e619763..9885d4386 100644 --- a/benchmarks/data/hbf_sheth01.txt +++ b/benchmarks/data/hbf_sheth01.txt @@ -1,10 +1,10 @@ # M bh(z=0) bh(z=0.5) bh(z=1) -1.000000000000000000e+11 7.776681202954768279e-01 8.726052797995176302e-01 1.026328900494410723e+00 -3.162277660168379517e+11 8.231452256725411143e-01 9.579326095218716475e-01 1.166849706598772851e+00 -1.000000000000000000e+12 8.955562632407376711e-01 1.086230445648761034e+00 1.373477738755017219e+00 -3.162277660168379395e+12 1.010100725767526519e+00 1.281946269353996914e+00 1.684328933206485024e+00 -1.000000000000000000e+13 1.192999257657698209e+00 1.587653537496100942e+00 2.166157743959469251e+00 -3.162277660168379297e+13 1.490964061572461752e+00 2.079775107877793516e+00 2.939345723126599808e+00 -1.000000000000000000e+14 1.992532064689338078e+00 2.904073345851900356e+00 4.234337370664857048e+00 -3.162277660168379375e+14 2.879147404518245246e+00 4.360606430422479640e+00 6.526762534863882692e+00 -1.000000000000000000e+15 4.541923831402939982e+00 7.098370543083665218e+00 1.084758973005238580e+01 +1.000000000000000000e+11 7.776972485405529989e-01 8.726622493246221079e-01 1.026424203582041894e+00 +3.162277660168379517e+11 8.231618246999494737e-01 9.579628075977009161e-01 1.166898843567207633e+00 +1.000000000000000000e+12 8.955535168462608331e-01 1.086225674296768640e+00 1.373470113095591971e+00 +3.162277660168379395e+12 1.010081997061661019e+00 1.281914654954347199e+00 1.684278943578891852e+00 +1.000000000000000000e+13 1.192984663736732731e+00 1.587629311904928731e+00 2.166119641289689035e+00 +3.162277660168379297e+13 1.491010996398029587e+00 2.079852377202842106e+00 2.939467069982377723e+00 +1.000000000000000000e+14 1.992736383841224868e+00 2.904408876188490751e+00 4.234864811863090495e+00 +3.162277660168379375e+14 2.879462249899637172e+00 4.361124023344535416e+00 6.527578103810970589e+00 +1.000000000000000000e+15 4.541530915563388504e+00 7.097722692586027726e+00 1.084656592066181879e+01 diff --git a/benchmarks/data/hbf_tinker10.txt b/benchmarks/data/hbf_tinker10.txt index df16417e4..11588b174 100644 --- a/benchmarks/data/hbf_tinker10.txt +++ b/benchmarks/data/hbf_tinker10.txt @@ -1,10 +1,10 @@ # M bh(z=0) bh(z=0.5) bh(z=1) -1.000000000000000000e+11 6.872277909133187590e-01 7.776003077242595873e-01 9.194211275524175608e-01 -3.162277660168379517e+11 7.314553271599522066e-01 8.561955898282382904e-01 1.051315198612180701e+00 -1.000000000000000000e+12 7.987782083865976324e-01 9.752747866288404843e-01 1.251084736045741330e+00 -3.162277660168379395e+12 9.043738322448846567e-01 1.161723773581716523e+00 1.564260479702074047e+00 -1.000000000000000000e+13 1.076206791330962087e+00 1.465330442398346200e+00 2.075504792965366718e+00 -3.162277660168379297e+13 1.367742929554508269e+00 1.981785569202430430e+00 2.948225413797276317e+00 -1.000000000000000000e+14 1.888005517955101187e+00 2.907212556598485431e+00 4.518677187194229283e+00 -3.162277660168379375e+14 2.878293743618493217e+00 4.677773553086010949e+00 7.537434778926495937e+00 -1.000000000000000000e+15 4.907871868414460437e+00 8.327369548258324983e+00 1.379022047163008935e+01 +1.000000000000000000e+11 6.872573220815004769e-01 7.776529821112694307e-01 9.195095939837698573e-01 +3.162277660168379517e+11 7.314710250374762968e-01 8.562234105354774583e-01 1.051361865929407724e+00 +1.000000000000000000e+12 7.987756781032956388e-01 9.752703167161380637e-01 1.251077234714920161e+00 +3.162277660168379395e+12 9.043564850672675126e-01 1.161693145513948755e+00 1.564208984615567566e+00 +1.000000000000000000e+13 1.076192867917550977e+00 1.465305819160845457e+00 2.075463269306847103e+00 +3.162277660168379297e+13 1.367789960650179104e+00 1.981869021754151694e+00 2.948366690860391159e+00 +1.000000000000000000e+14 1.888224095898458632e+00 2.907602196786330584e+00 4.519339758202555402e+00 +3.162277660168379375e+14 2.878658692597669599e+00 4.678427665164719862e+00 7.538552406165116793e+00 +1.000000000000000000e+15 4.907371193297252354e+00 8.326466918642736914e+00 1.378867075671933051e+01 diff --git a/benchmarks/data/hmf_angulo12.txt b/benchmarks/data/hmf_angulo12.txt index da1cf421f..34e4a8e20 100644 --- a/benchmarks/data/hmf_angulo12.txt +++ b/benchmarks/data/hmf_angulo12.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 3.094748916826953883e-02 3.378031759383857274e-02 3.613568406505979214e-02 -3.162277660168379517e+11 1.114829598851009747e-02 1.211144266851190386e-02 1.267393852863201928e-02 -1.000000000000000000e+12 4.037763811262027810e-03 4.314339663697940724e-03 4.326887218989615251e-03 -3.162277660168379395e+12 1.464579627486279224e-03 1.506445320391809357e-03 1.398921590193529050e-03 -1.000000000000000000e+13 5.227136522093540775e-04 4.981154955493578796e-04 4.038437092011037976e-04 -3.162277660168379297e+13 1.769530268012304089e-04 1.458725433225520579e-04 9.319642586870285818e-05 -1.000000000000000000e+14 5.298860509392899786e-05 3.332698503823671408e-05 1.393642515528801997e-05 -3.162277660168379375e+14 1.193197772546910532e-05 4.494674075209175221e-06 8.608417137474804150e-07 -1.000000000000000000e+15 1.397348333469064655e-06 1.923548637260446771e-07 8.131586026401090530e-09 +1.000000000000000000e+11 3.093214365310954783e-02 3.376354364800181196e-02 3.611729927919508226e-02 +3.162277660168379517e+11 1.114380579376655390e-02 1.210653112065732812e-02 1.266868639517805886e-02 +1.000000000000000000e+12 4.036930114164400361e-03 4.313452179041941600e-03 4.326004622865520927e-03 +3.162277660168379395e+12 1.464542630041314577e-03 1.506417829887866672e-03 1.398914574059349119e-03 +1.000000000000000000e+13 5.227806922032274956e-04 4.981826667610492676e-04 4.039027102489569070e-04 +3.162277660168379297e+13 1.769938982568021826e-04 1.459027215397174057e-04 9.321210969857087998e-05 +1.000000000000000000e+14 5.299161356781123810e-05 3.332506978292500691e-05 1.393316816936582496e-05 +3.162277660168379375e+14 1.192744397280473401e-05 4.492128823232369721e-06 8.601119973443051636e-07 +1.000000000000000000e+15 1.396825492881020198e-06 1.923293515433392670e-07 8.133444391990330869e-09 diff --git a/benchmarks/data/hmf_bocquet16.txt b/benchmarks/data/hmf_bocquet16.txt index 3d750ed1c..4a608a042 100644 --- a/benchmarks/data/hmf_bocquet16.txt +++ b/benchmarks/data/hmf_bocquet16.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 2.060686462628738211e-02 3.409883075087145887e-02 4.293017710892565314e-02 -3.162277660168379517e+11 7.284262292387328440e-03 1.151734227500286582e-02 1.368537634866818370e-02 -1.000000000000000000e+12 2.598839008209650331e-03 3.869614975815660433e-03 4.242103955474154330e-03 -3.162277660168379395e+12 9.319942138880181991e-04 1.281793670195204059e-03 1.254321707756549196e-03 -1.000000000000000000e+13 3.289012369473228608e-04 4.056343755754742981e-04 3.364932210915641021e-04 -3.162277660168379297e+13 1.088664406197575695e-04 1.141456885471121748e-04 7.339987618647146009e-05 -1.000000000000000000e+14 3.068751227046718816e-05 2.454852985852731972e-05 1.030996443127125109e-05 -3.162277660168379375e+14 5.906282034602051899e-06 2.859255170382127159e-06 5.519967653989010451e-07 -1.000000000000000000e+15 4.720166078783052328e-07 8.334777105594470248e-08 3.500569211712506270e-09 +1.000000000000000000e+11 2.059669210000169073e-02 3.408037143126638191e-02 4.290498256606626454e-02 +3.162277660168379517e+11 7.281339564228982500e-03 1.151248535438403713e-02 1.367931000519564261e-02 +1.000000000000000000e+12 2.598296654042016231e-03 3.868823728501560259e-03 4.241251833562103592e-03 +3.162277660168379395e+12 9.319671139538310885e-04 1.281777192141760188e-03 1.254329535438565438e-03 +1.000000000000000000e+13 3.289429005114029498e-04 4.056899212711873601e-04 3.365438121796169289e-04 +3.162277660168379297e+13 1.088913439747031433e-04 1.141687312362725916e-04 7.341173940802693174e-05 +1.000000000000000000e+14 3.068847601163054539e-05 2.454646425461225710e-05 1.030727867569705244e-05 +3.162277660168379375e+14 5.903680623280840998e-06 2.857463123769106252e-06 5.514950723269720281e-07 +1.000000000000000000e+15 4.718853572435385072e-07 8.334518930035160336e-08 3.501749610003077474e-09 diff --git a/benchmarks/data/hmf_despali16.txt b/benchmarks/data/hmf_despali16.txt index 01b58534e..29eeb2501 100644 --- a/benchmarks/data/hmf_despali16.txt +++ b/benchmarks/data/hmf_despali16.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 3.169263733417650164e-02 3.503763213941650523e-02 3.661565021685153631e-02 -3.162277660168379517e+11 1.154587676403608966e-02 1.242780930436370584e-02 1.246750216146328381e-02 -1.000000000000000000e+12 4.175673105354462539e-03 4.318068057164499256e-03 4.076537656161825264e-03 -3.162277660168379395e+12 1.488157551740544246e-03 1.446865413641410490e-03 1.244803914626467934e-03 -1.000000000000000000e+13 5.118590051108078609e-04 4.512331833266774550e-04 3.352498755811345347e-04 -3.162277660168379297e+13 1.635233791605738684e-04 1.227240314422474595e-04 7.171324693439564313e-05 -1.000000000000000000e+14 4.534217509598780573e-05 2.582905846274979785e-05 1.001436022212454191e-05 -3.162277660168379375e+14 9.366910447205875108e-06 3.242709819239950070e-06 6.001629258712866419e-07 -1.000000000000000000e+15 1.024980882590581262e-06 1.365400915990737825e-07 6.132166719362719170e-09 +1.000000000000000000e+11 3.167735202368920922e-02 3.502010408079311160e-02 3.659632181190230343e-02 +3.162277660168379517e+11 1.154124477089791927e-02 1.242270640590394104e-02 1.246220415901291151e-02 +1.000000000000000000e+12 4.174812071377938250e-03 4.317184111333301037e-03 4.075712353339184732e-03 +3.162277660168379395e+12 1.488125183800045144e-03 1.446848452676558709e-03 1.244808068770672776e-03 +1.000000000000000000e+13 5.119261912142030043e-04 4.512959457385258446e-04 3.353004310239199163e-04 +3.162277660168379297e+13 1.635597697724380090e-04 1.227482087288621273e-04 7.172464657208297634e-05 +1.000000000000000000e+14 4.534355349190921598e-05 2.582691526896411737e-05 1.001184202432403117e-05 +3.162277660168379375e+14 9.363141929649705750e-06 3.240826182105097158e-06 5.996553286968197047e-07 +1.000000000000000000e+15 1.024604606684415203e-06 1.365210657666597176e-07 6.133382865209971127e-09 diff --git a/benchmarks/data/hmf_despali16_m200c.txt b/benchmarks/data/hmf_despali16_m200c.txt new file mode 100644 index 000000000..4ac7ae248 --- /dev/null +++ b/benchmarks/data/hmf_despali16_m200c.txt @@ -0,0 +1,10 @@ +# M nM(z=0) nM(z=0.5) nM(z=1) +1.000000000000000000e+11 2.999616216314425141e-02 3.351086858916001165e-02 3.519803109877227970e-02 +3.162277660168379517e+11 1.073838391062035234e-02 1.176066089252483446e-02 1.189108799494030706e-02 +1.000000000000000000e+12 3.805790713827872113e-03 4.034885965604587815e-03 3.850463447592123237e-03 +3.162277660168379395e+12 1.323272394818513290e-03 1.330476889015134870e-03 1.160707191547670925e-03 +1.000000000000000000e+13 4.408461431114266810e-04 4.060563724963196135e-04 3.069600928047736335e-04 +3.162277660168379297e+13 1.347295730183517256e-04 1.070334157672294046e-04 6.388346739698165771e-05 +1.000000000000000000e+14 3.493563543965611770e-05 2.144771697582037166e-05 8.532927679552356327e-06 +3.162277660168379375e+14 6.459578043358292427e-06 2.477693260535457933e-06 4.735344852612243218e-07 +1.000000000000000000e+15 5.784717962695283401e-07 8.960343826153187708e-08 4.199386131980371550e-09 diff --git a/benchmarks/data/hmf_jenkins01.txt b/benchmarks/data/hmf_jenkins01.txt index af346bb70..63cadc8ca 100644 --- a/benchmarks/data/hmf_jenkins01.txt +++ b/benchmarks/data/hmf_jenkins01.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 3.379762007205055346e-02 3.552592595880724180e-02 3.560818467346407029e-02 -3.162277660168379517e+11 1.205845426321210112e-02 1.220956445350573211e-02 1.219329085298343288e-02 -1.000000000000000000e+12 4.192348195916272176e-03 4.195584309770181326e-03 4.132805850024258258e-03 -3.162277660168379395e+12 1.449818539761916656e-03 1.439981187871597736e-03 1.347088794234037453e-03 -1.000000000000000000e+13 5.017800356007884408e-04 4.780871733644988415e-04 3.939754060361338279e-04 -3.162277660168379297e+13 1.693511577809864491e-04 1.420887560914506646e-04 9.069795147258443899e-05 -1.000000000000000000e+14 5.151312339763651634e-05 3.245411970267962404e-05 1.305450589369507121e-05 -3.162277660168379375e+14 1.162440495059089484e-05 4.192663171280082481e-06 7.687697258693858584e-07 -1.000000000000000000e+15 1.295825055517311700e-06 1.721257420448881465e-07 8.735771057342227418e-09 +1.000000000000000000e+11 3.378122472900698531e-02 3.550712296728648215e-02 3.558916114575614437e-02 +3.162277660168379517e+11 1.205349565113121232e-02 1.220446426468535517e-02 1.218818116354648470e-02 +1.000000000000000000e+12 4.191488787067788706e-03 4.194724816280866186e-03 4.131962672033527226e-03 +3.162277660168379395e+12 1.449789972790282077e-03 1.439956047645140919e-03 1.347079710475801830e-03 +1.000000000000000000e+13 5.018449382998756104e-04 4.781512651642297763e-04 3.940327323074422228e-04 +3.162277660168379297e+13 1.693904771417786728e-04 1.421183729573919090e-04 9.071301081709442311e-05 +1.000000000000000000e+14 5.151630798535901038e-05 3.245206464875261947e-05 1.305122540775322916e-05 +3.162277660168379375e+14 1.161992716576597495e-05 4.190217626860768765e-06 7.681166857839895198e-07 +1.000000000000000000e+15 1.295356393183816121e-06 1.721018764271546274e-07 8.736983499804311022e-09 diff --git a/benchmarks/data/hmf_press74.txt b/benchmarks/data/hmf_press74.txt index e04b3aff8..eedda7fb2 100644 --- a/benchmarks/data/hmf_press74.txt +++ b/benchmarks/data/hmf_press74.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 4.414415108757038797e-02 5.101272970220191438e-02 5.454191350038296165e-02 -3.162277660168379517e+11 1.653381101988063429e-02 1.839999143733269185e-02 1.860287510421346213e-02 -1.000000000000000000e+12 6.121332111125298361e-03 6.445942801095395393e-03 6.003604130596471196e-03 -3.162277660168379395e+12 2.215309548926015261e-03 2.145671454729122882e-03 1.765143549744807670e-03 -1.000000000000000000e+13 7.623141410370214100e-04 6.476889870490261684e-04 4.386462554810763455e-04 -3.162277660168379297e+13 2.370292551384320389e-04 1.627236407920079500e-04 8.030590386954173775e-05 -1.000000000000000000e+14 6.073073403581667718e-05 2.901416800837839922e-05 8.359090822021201335e-06 -3.162277660168379375e+14 1.046379269894013888e-05 2.605803080014085578e-06 2.853781989051997120e-07 -1.000000000000000000e+15 7.717796417079245288e-07 5.533585481575594443e-08 9.543284440038681117e-10 +1.000000000000000000e+11 4.412391303068649573e-02 5.098803377645079460e-02 5.451343140499804313e-02 +3.162277660168379517e+11 1.652730318204146884e-02 1.839250738652616762e-02 1.859494579613904172e-02 +1.000000000000000000e+12 6.120066114126252246e-03 6.444622834477395715e-03 6.002392948173975590e-03 +3.162277660168379395e+12 2.215258638772358690e-03 2.145651119662254653e-03 1.765162209076581159e-03 +1.000000000000000000e+13 7.624147095823471942e-04 6.477811854538397278e-04 4.387154854059610348e-04 +3.162277660168379297e+13 2.370806116472641686e-04 1.627534146818524060e-04 8.031658052478227931e-05 +1.000000000000000000e+14 6.073032583020885223e-05 2.900965930822526633e-05 8.355947132188306636e-06 +3.162277660168379375e+14 1.045885389368399040e-05 2.603965617166774937e-06 2.850782140190710416e-07 +1.000000000000000000e+15 7.715716038180508261e-07 5.533735383404692417e-08 9.547747408375131568e-10 diff --git a/benchmarks/data/hmf_sheth99.txt b/benchmarks/data/hmf_sheth99.txt index 45b4353fd..74e7d6447 100644 --- a/benchmarks/data/hmf_sheth99.txt +++ b/benchmarks/data/hmf_sheth99.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 3.191354981432509286e-02 3.481051215237113139e-02 3.617291103048971002e-02 -3.162277660168379517e+11 1.153963188988697125e-02 1.229632442873349225e-02 1.231930801820072495e-02 -1.000000000000000000e+12 4.146611494479836985e-03 4.264420183004791545e-03 4.044880256550390137e-03 -3.162277660168379395e+12 1.471102132211440103e-03 1.431676945105068207e-03 1.248352630730411791e-03 -1.000000000000000000e+13 5.054121493911315236e-04 4.502970910712863106e-04 3.435364837482439621e-04 -3.162277660168379297e+13 1.622663452677254559e-04 1.249341408492411450e-04 7.652868034690279411e-05 -1.000000000000000000e+14 4.572821167022988700e-05 2.738830426977602038e-05 1.151980938169084458e-05 -3.162277660168379375e+14 9.811650778598503711e-06 3.728374462686285641e-06 7.953561238439724200e-07 -1.000000000000000000e+15 1.165776011331435346e-06 1.848097603639989374e-07 1.072734504562773406e-08 +1.000000000000000000e+11 3.189795291818745687e-02 3.479295688320236529e-02 3.615378035362162151e-02 +3.162277660168379517e+11 1.153497865726851000e-02 1.229126409750084560e-02 1.231407969227290428e-02 +1.000000000000000000e+12 4.145757169094448427e-03 4.263547256866470278e-03 4.044060518485742550e-03 +3.162277660168379395e+12 1.471070745873015581e-03 1.431659295872275521e-03 1.248354322653162565e-03 +1.000000000000000000e+13 5.054784473398790754e-04 4.503593487734176468e-04 3.435876507680986043e-04 +3.162277660168379297e+13 1.623026450896842719e-04 1.249591893674079112e-04 7.654135916098117295e-05 +1.000000000000000000e+14 4.572995458842858267e-05 2.738651536785488306e-05 1.151727660345356812e-05 +3.162277660168379375e+14 9.807846314068841342e-06 3.726319939099284353e-06 7.947243030930668489e-07 +1.000000000000000000e+15 1.165324376822248128e-06 1.847767170199219965e-07 1.072875744169179223e-08 diff --git a/benchmarks/data/hmf_tinker08.txt b/benchmarks/data/hmf_tinker08.txt index 2e484e0d7..e8c2fe79d 100644 --- a/benchmarks/data/hmf_tinker08.txt +++ b/benchmarks/data/hmf_tinker08.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 3.346826634170656234e-02 3.457431968168174496e-02 3.487040818496181527e-02 -3.162277660168379517e+11 1.212500206724132640e-02 1.233655667946752764e-02 1.203436702877300375e-02 -1.000000000000000000e+12 4.400486020894409794e-03 4.346642473934255076e-03 4.011811177106579078e-03 -3.162277660168379395e+12 1.590539104340125054e-03 1.489124873622474799e-03 1.254620708095070120e-03 -1.000000000000000000e+13 5.612074848263419241e-04 4.781756719384255361e-04 3.463312753501920438e-04 -3.162277660168379297e+13 1.858334420438916652e-04 1.342725157940911993e-04 7.535879314393955633e-05 -1.000000000000000000e+14 5.369058514071735604e-05 2.895261008976671735e-05 1.043589625578711804e-05 -3.162277660168379375e+14 1.145936532262167996e-05 3.608588532452667924e-06 5.818673461653930457e-07 -1.000000000000000000e+15 1.241530646075415037e-06 1.383667585850740122e-07 4.760420213320270607e-09 +1.000000000000000000e+11 3.345186245282368021e-02 3.455708550726797890e-02 3.485229952539109499e-02 +3.162277660168379517e+11 1.212013309415235079e-02 1.233152660149548427e-02 1.202931092786921688e-02 +1.000000000000000000e+12 4.399577481661968124e-03 4.345750281306762393e-03 4.010996295781623332e-03 +3.162277660168379395e+12 1.590500393734907208e-03 1.489102332647187100e-03 1.254620761714267743e-03 +1.000000000000000000e+13 5.612800416312988244e-04 4.782412218930593914e-04 3.463830004612770334e-04 +3.162277660168379297e+13 1.858757124296534706e-04 1.342994758226627341e-04 7.537085139075797545e-05 +1.000000000000000000e+14 5.369289507688052043e-05 2.895033634692162686e-05 1.043317004537173140e-05 +3.162277660168379375e+14 1.145481503545911178e-05 3.606456624915666225e-06 5.813556233260852550e-07 +1.000000000000000000e+15 1.241086065776340660e-06 1.383515294903762839e-07 4.761650498337523457e-09 diff --git a/benchmarks/data/hmf_watson13.txt b/benchmarks/data/hmf_watson13.txt index fd8847794..c0e953106 100644 --- a/benchmarks/data/hmf_watson13.txt +++ b/benchmarks/data/hmf_watson13.txt @@ -1,10 +1,10 @@ # M nM(z=0) nM(z=0.5) nM(z=1) -1.000000000000000000e+11 2.990465369564174539e-02 2.920286219264831701e-02 2.447270667533036834e-02 -3.162277660168379517e+11 1.087038726130745182e-02 1.059296689836000845e-02 8.996207266666878671e-03 -1.000000000000000000e+12 3.978107096996899052e-03 3.870193564399278686e-03 3.256494883047504011e-03 -3.162277660168379395e+12 1.458561006977250303e-03 1.408355523477234240e-03 1.125586706756068851e-03 -1.000000000000000000e+13 5.252501268409142917e-04 4.926761900596759482e-04 3.474672866799629299e-04 -3.162277660168379297e+13 1.782548309348293844e-04 1.537953768989237194e-04 8.440037543885671207e-05 -1.000000000000000000e+14 5.267689954187321509e-05 3.703649607124748444e-05 1.268267618856844397e-05 -3.162277660168379375e+14 1.130798673758184095e-05 5.004273055183382502e-06 7.068601944952023347e-07 -1.000000000000000000e+15 1.170937663020138653e-06 1.872486003726185976e-07 4.734347403584181341e-09 +1.000000000000000000e+11 2.989002807273068163e-02 2.918850418038419423e-02 2.446107760023110214e-02 +3.162277660168379517e+11 1.086603992728777876e-02 1.058872646039747852e-02 8.992618006155153609e-03 +1.000000000000000000e+12 3.977284410738276925e-03 3.869393544070202137e-03 3.255824329542492731e-03 +3.162277660168379395e+12 1.458522178298541369e-03 1.408320714541038115e-03 1.125570926497994643e-03 +1.000000000000000000e+13 5.253172661764677741e-04 4.927406874738205758e-04 3.475166695328055244e-04 +3.162277660168379297e+13 1.782959308960196379e-04 1.538283851396846352e-04 8.441494287118777771e-05 +1.000000000000000000e+14 5.267945859964400640e-05 3.703479049297839221e-05 1.267957412296742391e-05 +3.162277660168379375e+14 1.130346184595758752e-05 5.001377896456568076e-06 7.062249623703568252e-07 +1.000000000000000000e+15 1.170536765495418046e-06 1.872319112242870056e-07 4.735872736586220141e-09 diff --git a/benchmarks/test_hmf.py b/benchmarks/test_hmf.py index 72f7fd27a..8f2c3fd4b 100644 --- a/benchmarks/test_hmf.py +++ b/benchmarks/test_hmf.py @@ -26,6 +26,18 @@ def test_hmf_despali16(): assert np.all(np.fabs(nm_h / nm_d - 1) < 0.01) +def test_hmf_despali16_m200c(): + # Different mass definition + mf = ccl.halos.MassFuncDespali16(mass_def='200c') + d_hmf = np.loadtxt(os.path.join(dirdat, 'hmf_despali16_m200c.txt'), + unpack=True) + m = d_hmf[0] + for iz, z in enumerate(zs): + nm_d = d_hmf[iz+1] + nm_h = mf(cosmo, m, 1. / (1 + z)) + assert np.all(np.fabs(nm_h / nm_d - 1) < 0.01) + + def test_hmf_bocquet16(): mf = ccl.halos.MassFuncBocquet16(mass_def="200c") d_hmf = np.loadtxt(os.path.join(dirdat, 'hmf_bocquet16.txt'), diff --git a/pyccl/halos/hmfunc/despali16.py b/pyccl/halos/hmfunc/despali16.py index d1c92c409..880824fb7 100644 --- a/pyccl/halos/hmfunc/despali16.py +++ b/pyccl/halos/hmfunc/despali16.py @@ -41,7 +41,7 @@ def _setup(self): 0.2488, 0.2554, -0.1151)} A0, A1, a0, a1, a2, p0, p1, p2 = vals[self.ellipsoidal] - coeffs = [[A1, A0], [a2, a1, a0], [p2, p2, p0]] + coeffs = [[A1, A0], [a2, a1, a0], [p2, p1, p0]] self.poly_A, self.poly_a, self.poly_p = map(np.poly1d, coeffs) def _get_fsigma(self, cosmo, sigM, a, lnM):