def unaugment_tiles(y):
    """ reverse test-time augmentations for averaging

    Parameters
    ----------

    y: float32
        array that's ntiles x chan x Ly x Lx where chan = (dY, dX, cell prob)
        if unet is used, array is ntiles x 1 x Ly x Lx

    Returns
    -------
    
    y: float32

    """
    for k in range(y.shape[0]):
        if k % 4 == 1:
            y[(k), :, :, :] = y[(k), :, ::-1, :]
            y[(k), (0), :, :] *= -1
        if k % 4 == 2:
            y[(k), :, :, :] = y[(k), :, :, ::-1]
            y[(k), (1), :, :] *= -1
        if k % 4 == 3:
            y[(k), :, :, :] = y[(k), :, ::-1, ::-1]
            y[(k), (0), :, :] *= -1
            y[(k), (1), :, :] *= -1
    return y
