Take the fft of the theta extended map, then zero pad and reorganize it

    This is mostly an internal function, included here for backwards compatibility.  See map2salm
    and salm2map for more useful functions.

def Imm(extended_map, s, lmax):
    """Take the fft of the theta extended map, then zero pad and reorganize it

    This is mostly an internal function, included here for backwards compatibility.  See map2salm
    and salm2map for more useful functions.

    """
    import numpy as np
    extended_map = np.ascontiguousarray(extended_map, dtype=np.complex128)
    NImm = (2*lmax + 1)**2
    imm = np.empty(NImm, dtype=np.complex128)
    _Imm(extended_map, imm, s, lmax)
    return imm