def cl2cfft(cl, pix): """ returns a maps.cfft object with the pixelization pix, with FFT(lx,ly) = linear interpolation of cl[l] at l = sqrt(lx**2 + ly**2). """ ell = pix.get_ell().flatten() ret = maps.cfft( nx=pix.nx, dx=pix.dx, fft=np.array( np.interp( ell, np.arange(0, len(cl)), cl, right=0 ).reshape(pix.ny, pix.nx), dtype=np.complex ), ny=pix.ny, dy=pix.dy ) #RA: fixes issue with nx!=ny by reversing ny, nx in the reshape. return ret
def cl2cfft(cl, pix): """ returns a maps.cfft object with the pixelization pix, with FFT(lx,ly) = linear interpolation of cl[l] at l = sqrt(lx**2 + ly**2). """ ell = pix.get_ell().flatten() ret = maps.cfft( nx=pix.nx, dx=pix.dx, fft=np.array( np.interp( ell, np.arange(0, len(cl)), cl, right=0 ).reshape(pix.nx, pix.ny), dtype=np.complex ), ny=pix.ny, dy=pix.dy ) return ret