def derivative(u, var):
    """
    Returns the derivative of u along var, if u is an
    uncertainties.AffineScalarFunc instance, and if var is one of the
    variables on which it depends.  Otherwise, return 0.
    """
    if isinstance(u, uncertainties.AffineScalarFunc):
        try:
            return u.derivatives[var]
        except __HOLE__:
            return 0.
    else:
        return 0.
dataset/ETHPy150Open xraypy/xraylarch/lib/fitting/uncertainties/unumpy/core.py/derivative