def wMean(values):
    """
    Calculates weighted mean of a list of ufloats
    """
    wsum = 0.0
    weights = 0.0
    for val in values:
        weights += 1 / (val.std_dev / val.nominal_value)
        wsum += val.value * 1.0 / (val.std_dev / val.nominal_value)
    return wsum / weights
