def get_func_limits(func, xvals, params=None):
    """Returns minimum and maximum of scalar function <func> in the range given
    by <xvals> and with optionnal <params>"""
    if params:
        yvals = list([func(x, *params) for x in xvals])
    else:
        yvals = list([func(x) for x in xvals])
    minimum = min(yvals)
    maximum = max(yvals)
    return (minimum, maximum)