def squish(r, axis):
    """
    Squish array along an axis.

    Determine the sum along all but one axis for an array.

    Parameters
    ----------
    r : ndarray
        Array to squish.
    axis : int
        Axis of r to squish along.

    Returns
    -------
    s : 1D ndarray
        Array r squished into a single dimension.

    """
    N = int(r.ndim)
    r = r.swapaxes(axis, N - 1)
    for i in range(N - 1):
        r = r.sum(0)
    return r
