Ejemplo n.º 1
0
    def __add__(self, other):
        if is_clmat_teb(other):
            assert (self.compatible(other))
            ret = copy.deepcopy(self)
            ret.clmat += other.clmat
            return ret
        elif maps.is_tebfft(other):
            teb = other
            ret = teb.copy()
            ell = teb.get_ell()

            ret.tfft[:, :] += np.interp(ell.flatten(),
                                        np.arange(0, len(self.clmat[:, 0, 0])),
                                        self.clmat[:, 0, 0],
                                        right=0).reshape(ell.shape)
            ret.efft[:, :] += np.interp(ell.flatten(),
                                        np.arange(0, len(self.clmat[:, 1, 1])),
                                        self.clmat[:, 1, 1],
                                        right=0).reshape(ell.shape)
            ret.bfft[:, :] += np.interp(ell.flatten(),
                                        np.arange(0, len(self.clmat[:, 2, 2])),
                                        self.clmat[:, 2, 2],
                                        right=0).reshape(ell.shape)

            return ret
        else:
            assert (0)
Ejemplo n.º 2
0
def cross_cl(lbins, r1, r2=None, w=None):
    """ returns the auto- or cross-spectra of either rfft or tebfft objects. this is a convenience wrapper around tebfft2cl and rcfft2cl. """
    if r2 is None:
        r2 = r1
    assert (r1.compatible(r2))

    if maps.is_tebfft(r1):
        return tebfft2cl(lbins, r1, r2, t=t)
    elif maps.is_rfft(r1):
        return rcfft2cl(lbins, r1, r2, t=t)
    elif maps.is_cfft(r1):
        return rcfft2cl(lbins, r1, r2, t=t)
    else:
        assert (0)
Ejemplo n.º 3
0
def cross_cl( lbins, r1, r2=None, w=None ):
    """ returns the auto- or cross-spectra of either rfft or tebfft objects. this is a convenience wrapper around tebfft2cl and rcfft2cl. """
    if r2 is None:
        r2 = r1
    assert( r1.compatible( r2 ) )

    if maps.is_tebfft(r1):
        return tebfft2cl(lbins, r1, r2, t=t)
    elif maps.is_rfft(r1):
        return rcfft2cl(lbins, r1, r2, t=t)
    elif maps.is_cfft(r1):
        return rcfft2cl(lbins, r1, r2, t=t)
    else:
        assert(0)
Ejemplo n.º 4
0
    def __add__(self, other):
        if is_clmat_teb(other):
            assert( self.compatible(other) )
            ret = copy.deepcopy(self)
            ret.clmat += other.clmat
            return ret
        elif maps.is_tebfft(other):
            teb = other
            ret = teb.copy()
            ell = teb.get_ell()

            ret.tfft[:,:]  += np.interp( ell.flatten(), np.arange(0, len(self.clmat[:,0,0])), self.clmat[:,0,0], right=0 ).reshape(ell.shape)
            ret.efft[:,:]  += np.interp( ell.flatten(), np.arange(0, len(self.clmat[:,1,1])), self.clmat[:,1,1], right=0 ).reshape(ell.shape)
            ret.bfft[:,:]  += np.interp( ell.flatten(), np.arange(0, len(self.clmat[:,2,2])), self.clmat[:,2,2], right=0 ).reshape(ell.shape)

            return ret
        else:
            assert(0)