def get_nhl(qe_key1, qe_key2, cls_weights, cls_ivfs, lmax_ivf1, lmax_ivf2, lmax_out=None, lmax_ivf12=None, lmax_ivf22=None, cls_ivfs_bb=None, cls_ivfs_ab=None): """(Semi-)Analytical noise level calculation for the cross-spectrum of two QE keys. Args: qe_key1: QE key 1 qe_key2: QE key 2 cls_weights: dictionary with the CMB spectra entering the QE weights. (expected are 'tt', 'te', 'ee' when/if relevant) cls_ivfs: dictionary with the inverse-variance filtered CMB spectra. (expected are 'tt', 'te', 'ee', 'bb', 'tb', 'eb' when/if relevant) lmax_ivf1: QE 1 uses CMB multipoles down to lmax_ivf1. lmax_ivf2: QE 2 uses CMB multipoles down to lmax_ivf2. lmax_out(optional): outputs are calculated down to lmax_out. Defaults to lmax_ivf1 + lmax_ivf2 Outputs: 4-tuple of gradient (G) and curl (C) mode Gaussian noise co-variances GG, CC, GC, CG. """ if lmax_ivf12 is None: lmax_ivf12 = lmax_ivf1 if lmax_ivf22 is None: lmax_ivf22 = lmax_ivf2 qes1 = qresp.get_qes(qe_key1, lmax_ivf1, cls_weights, lmax2=lmax_ivf12) qes2 = qresp.get_qes(qe_key2, lmax_ivf2, cls_weights, lmax2=lmax_ivf22) if lmax_out is None: lmax_out = max(lmax_ivf1, lmax_ivf12) + max(lmax_ivf2, lmax_ivf22) return _get_nhl(qes1, qes2, cls_ivfs, lmax_out, cls_ivfs_bb=cls_ivfs_bb, cls_ivfs_ab=cls_ivfs_ab)
def eval_qe(qe_key, lmax_ivf, cls_weight, get_alm, nside, lmax_qlm, verbose=True): """Evaluates a quadratic estimator gradient and curl terms. (see 'library' below for QE estimation coupled to CMB inverse-variance filtered simulation libraries, whose implementation can be faster for some estimators.) Args: qe_key: QE key defining the estimator (as defined in the qresp module), e.g. 'ptt' for lensing TT estimator lmax_ivf: CMB multipoles up to lmax are used in the QE cls_weight: set of CMB spectra entering the QE estimator weights get_alm: callable with 't', 'e', 'b' arguments, returning the corresponding inverse-variance filtered CMB map nside: the estimator are calculated in position space at healpy resolution nside. lmax_qlm: gradient and curl terms are obtained up to multipole lmax_qlm. Returns: glm and clm healpy arrays (gradient and curl terms of the QE estimate) """ qe_list = qresp.get_qes(qe_key, lmax_ivf, cls_weight) return uqe.qe_eval(qe_list, nside, get_alm, lmax_qlm, verbose=verbose)