def fmtErr(val, std, precision = 2, width = None):
    """Formats a given value and its std. deviation to physics notation, e.g. '1.23(4)'."""
    if width is None: width = ""
    fmt = "{:"+str(width)+"."+str(precision)+"f}({:.0f})"
    #print("fmtErr val:", val, "std:", std)
    return fmt.format(val, std * 10**(precision))