Substitute 0s in the list with a near-zero value.

    Parameters
    -----------
    arr : numpy.array(float)
    default_min_value : float
        If the smallest non-zero element in `arr` is greater than the default,
        use the default instead.

    Returns
    -----------
    numpy.array(float)

def _replace_zeros(arr, default_min_value):
    """Substitute 0s in the list with a near-zero value.

    Parameters
    -----------
    arr : numpy.array(float)
    default_min_value : float
        If the smallest non-zero element in `arr` is greater than the default,
        use the default instead.

    Returns
    -----------
    numpy.array(float)
    """
    min_nonzero_value = min(default_min_value, np.min(arr[arr > 0]))
    closest_to_zero = np.nextafter(min_nonzero_value, min_nonzero_value - 1)
    arr[arr == 0] = closest_to_zero
    return arr