def clip_args(func, arg1, arg2, bounds=(0.0, 1.0)):
    """
    Clip the arguments to bounds

    Return the results of the function where the clipped arguments have been used.
    Arguments below the lower bound are set to the lower bound and the arguments
    above the upper bound are set to the upper bound.

    Parameters
    ----------
    func : func(arg1,arg2)
        The function which the clipped arguments are passed to
    arg1 : ndarray
        1D array with floats.
    arg2 : ndarray.
        1D array with floats.
    bounds : tuple, optional
        The bounds that the arguments are limited to.

    Returns
    -------
    clipped_func : func(arg1_clipped,arg2_clipped)
        The results of the function where the clipped agruments have been applied.


    Notes
    -----
    This function does not do any type of typechecking
    """
    upper_bound = bounds[1]
    lower_bound = bounds[0]
    arg1_inbound = arg1.copy()
    arg2_inbound = arg2.copy()
    arg1_inbound[arg1 < lower_bound] = lower_bound
    arg1_inbound[arg1 > upper_bound] = upper_bound
    arg2_inbound[arg2 < lower_bound] = lower_bound
    arg2_inbound[arg2 > upper_bound] = upper_bound
    return func(arg1_inbound, arg2_inbound)
