def convert_frac(ratio):
    """ Converts ratio strings into float, e.g. 1.0/2.0 -> 0.5 """
    try:
        return float(ratio)
    except ValueError:
        num, denom = ratio.split('/')
        return float(num) / float(denom)