def ra2float(ra):
    """
    Convert ra to degress (float).
    ra can be given as a time string, HH:MM:SS.SS or as string like '25.6554'
    or (trivially) as a float.
    An exception is thrown if ra is invalid
    360 deg = 24 hrs, 360/24 = 15
    """
    if ra is None:
        return ra
    if type(ra) is float or type(ra) is int:
        return float(ra)
    if (type(ra) is str or type(ra) is str) and ra.find(':') == -1:
        return float(ra)     
    try:
        return float(ra)      # catch numpy types
    except:
        pass
    assert type(ra) is str,'Invalid parameter format (ra2float - data type %r)' % type(ra)
    h,m,s = ra.strip().split(':')
    if h.find('-') != -1:
        h=h.replace('-','')
        sign = -1.0
    else:
        sign = 1.0
    return sign*(float(h)*15.0 + float(m)/4.0 + float(s)/240.0)