Extend map of function to cover sphere "twice" up to theta=2pi

    This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
    easier to perform certain transformation operations.

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

def f_extend_MW(map, s):
    """Extend map of function to cover sphere "twice" up to theta=2pi

    This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
    easier to perform certain transformation operations.

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

    """
    import numpy as np
    map = np.ascontiguousarray(map, dtype=np.complex128)
    extended_map = np.empty((2*(map.shape[0]-1), map.shape[1],), dtype=np.complex128)
    _f_extend_MW(map, extended_map, s)
    return extended_map