def fftmod(out):
    """Performs a modulated FFT on the input, that is multiplying every other line by exp(j*pi) which is a shift of N/2, hence modulating the output by +/- pi.

    Args:
        out (array_like): Input to the FFT.

    Returns:
        The modulated FFT of the input.
    """

    out2 = out.copy()
    out2[...,::2,:] *= -1
    out2[...,:,::2] *= -1
    out2 *= -1
    return out2