Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Small bug in I_0_22 #1233

@Sefa76

Description

@Sefa76

Hola:
I found a small bug in the I_0_22 method of the HMCalculator class.
The function claims that if no prof2 is passed, it will default to use prof. This is not correctly implemented and it will throw an exception:

import pyccl as ccl
import numpy as np

k = np.geomspace(1e-3, 10)

cosmo = ccl.Cosmology(Omega_c=0.25, Omega_b=0.05,
                          h=0.7, n_s=0.95, sigma8=0.8,
                          transfer_function='bbks')

cM = ccl.halos.ConcentrationDiemer15()
nM = ccl.halos.MassFuncSheth99(mass_def=ccl.halos.MassDef200c, mass_def_strict=False)
bM = ccl.halos.HaloBiasSheth99(mass_def=ccl.halos.MassDef200c, mass_def_strict=False)
pM = ccl.halos.HaloProfileNFW(mass_def=ccl.halos.MassDef200c, concentration=cM, fourier_analytic=True)
hmc = ccl.halos.HMCalculator(mass_function=nM, halo_bias=bM)
p2pt = ccl.halos.Profile2pt()

I0_3_CL = hmc.I_0_22(cosmo, k, 1, prof=pM, prof12_2pt=p2pt)

AttributeError: 'NoneType' object has no attribute 'mass_def'

If this is the expected behaviour, the documentation should be changed, else a quick fix

if prof2 is None:
    prof2 = prof

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions