<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def measurements_to_bf(measurements: np.ndarray) -> float: """ Convert measurements into gradient binary fraction. :param measurements: Output measurements of gradient program. :return: Binary fraction representation of gradient estimate. """

    try:
        measurements.sum(axis=0)
    except AttributeError:
        measurements = np.asarray(measurements)
    finally:
        stats = measurements.sum(axis=0) / len(measurements)

    stats_str = [str(int(i)) for i in np.round(stats[::-1][1:])]
    bf_str = '0.' + ''.join(stats_str)
    bf = float(bf_str)

    return bf