def get_camb_cl(r, lmax, nt=None, spec='total', lfac=True):
    "\n    Compute camb spectrum with tensors and lensing.\n\n    Parameter values are from arXiv:1807.06209 Table 1 Plik best fit\n\n    Arguments\n    ---------\n    r : float\n        Tensor-to-scalar ratio\n    lmax : int\n        Maximum ell for which to compute spectra\n    nt : scalar, optional\n        Tensor spectral index.  If not supplied, assumes\n        slow-roll consistency relation.\n    spec : string, optional\n        Spectrum component to return.  Can be 'total', 'unlensed_total',\n        'unlensed_scalar', 'lensed_scalar', 'tensor', 'lens_potential'.\n    lfac: bool, optional\n        If True, multiply Cls by ell*(ell+1)/2/pi\n\n    Returns\n    -------\n    cls : array_like\n        Array of spectra of shape (lmax + 1, nspec).\n        Diagonal ordering (TT, EE, BB, TE).\n    "
    import camb
    pars = camb.CAMBparams()
    pars.set_cosmology(H0=67.32, ombh2=0.022383, omch2=0.12011, mnu=0.06, omk=0, tau=0.0543)
    ln1010As = 3.0448
    pars.InitPower.set_params(As=(np.exp(ln1010As) / 10000000000.0), ns=0.96605, r=r, nt=nt)
    if (lmax < 2500):
        lmax0 = 2500
    else:
        lmax0 = lmax
    pars.set_for_lmax(lmax0, lens_potential_accuracy=2)
    pars.WantTensors = True
    pars.do_lensing = True
    results = camb.get_results(pars)
    powers = results.get_cmb_power_spectra(pars, CMB_unit='muK', raw_cl=(not lfac))
    totCL = powers[spec][:(lmax + 1), :4].T
    return totCL
Compute camb spectrum with tensors and lensing.

Parameter values are from arXiv:1807.06209 Table 1 Plik best fit

Arguments
---------
r : float
    Tensor-to-scalar ratio
lmax : int
    Maximum ell for which to compute spectra
nt : scalar, optional
    Tensor spectral index.  If not supplied, assumes
    slow-roll consistency relation.
spec : string, optional
    Spectrum component to return.  Can be 'total', 'unlensed_total',
    'unlensed_scalar', 'lensed_scalar', 'tensor', 'lens_potential'.
lfac: bool, optional
    If True, multiply Cls by ell*(ell+1)/2/pi

Returns
-------
cls : array_like
    Array of spectra of shape (lmax + 1, nspec).
    Diagonal ordering (TT, EE, BB, TE).
def get_camb_cl(r, lmax, nt=None, spec='total', lfac=True):
    "\n    Compute camb spectrum with tensors and lensing.\n\n    Parameter values are from arXiv:1807.06209 Table 1 Plik best fit\n\n    Arguments\n    ---------\n    r : float\n        Tensor-to-scalar ratio\n    lmax : int\n        Maximum ell for which to compute spectra\n    nt : scalar, optional\n        Tensor spectral index.  If not supplied, assumes\n        slow-roll consistency relation.\n    spec : string, optional\n        Spectrum component to return.  Can be 'total', 'unlensed_total',\n        'unlensed_scalar', 'lensed_scalar', 'tensor', 'lens_potential'.\n    lfac: bool, optional\n        If True, multiply Cls by ell*(ell+1)/2/pi\n\n    Returns\n    -------\n    cls : array_like\n        Array of spectra of shape (lmax + 1, nspec).\n        Diagonal ordering (TT, EE, BB, TE).\n    "
    import camb
    pars = camb.CAMBparams()
    pars.set_cosmology(H0=67.32, ombh2=0.022383, omch2=0.12011, mnu=0.06, omk=0, tau=0.0543)
    ln1010As = 3.0448
    pars.InitPower.set_params(As=(np.exp(ln1010As) / 10000000000.0), ns=0.96605, r=r, nt=nt)
    if (lmax < 2500):
        lmax0 = 2500
    else:
        lmax0 = lmax
    pars.set_for_lmax(lmax0, lens_potential_accuracy=2)
    pars.WantTensors = True
    pars.do_lensing = True
    results = camb.get_results(pars)
    powers = results.get_cmb_power_spectra(pars, CMB_unit='muK', raw_cl=(not lfac))
    totCL = powers[spec][:(lmax + 1), :4].T
    return totCL