def ra2hhmmss(deg):
    """Convert RA coordinate (in degrees) to HH MM SS"""
    from math import modf
    if deg < 0:
        deg += 360.0
    x, hh = modf(deg / 15.0)
    x, mm = modf(x * 60)
    ss = x * 60
    return int(hh), int(mm), ss
