Example #1
0
    def __init__(self, cl, res, lsides, with_pixwin=False):
        assert len(res) == len(lsides) and len(res) == 2

        self.cl = cl
        self.res = res
        self.shape = (2 ** res[0], 2 ** res[1])
        self.lsides = lsides
        self.lib_cube = cube.library_datacube(res, lsides, verbose=False)

        self._w_pixwin = with_pixwin
        super(circulant2d_fromcl, self).__init__(self.get_spec_mat(), self.shape, lsides)
Example #2
0
def spec_mat_from_cl(cl, res, lsides):
    """
    Common routine to build spectral matrix from cl. Input are squared frequencies, the cl vector,
    the resolution res (N = 2**res) of the box, and the side lengths.
    """
    assert len(res) == len(lsides)
    for r in res : assert r < 16,'Do you really want 2**16 points ?? '+ str(r)
    # TODO : Frankly, this is cheap. You can do better, come on.
    # TODO : It might actually be OK. but the zeroth mode definitely needs some adjustement.
    # TODO : do that by computing truncated integrals of legendre pol.
    lib_cub = cube.library_datacube(res, lsides)
    k_sqd = lib_cub.sqd_freqmap()
    return np.interp(np.sqrt(k_sqd), np.arange(len(cl)), cl / lib_cub.cell_vol(), left=0., right=0.)