Convert the value into the most basic representation that we can do
    math on: float if possible, then Uval, then Lval.

def unwrap(msmt):
    """Convert the value into the most basic representation that we can do
    math on: float if possible, then Uval, then Lval."""

    if np.isscalar(msmt):
        return float(msmt)
    if isinstance(msmt, (Uval, Lval)):
        return msmt
    if isinstance(msmt, Textual):
        return msmt.unwrap()
    raise ValueError('don\'t know how to treat %r as a measurement' % msmt)