Get a best-effort representative value as a float. This is DANGEROUS
    because it discards limit information, which is rarely wise. m_liminfo()
    or m_unwrap() are recommended instead.

def repval(msmt, limitsok=False):
    """Get a best-effort representative value as a float. This is DANGEROUS
    because it discards limit information, which is rarely wise. m_liminfo()
    or m_unwrap() are recommended instead."""

    if np.isscalar(msmt):
        return float(msmt)
    if isinstance(msmt, Uval):
        return msmt.repvals(uval_default_repval_method)[0]
    if isinstance(msmt, Lval):
        if not limitsok and msmt.kind in('tozero', 'toinf', 'pastzero'):
            raise LimitError()
        return msmt.value
    if isinstance(msmt, Textual):
        return msmt.repval(limitsok=limitsok)

    raise ValueError('don\'t know how to treat %r as a measurement' % msmt)