def get_RUWE(source_ids):
    """Use Gaia DR2 source id to return the re-normalised unit weight error for the solution"""
    import warnings
    warnings.filterwarnings('ignore')
    import numpy as np
    from astroquery.gaia import Gaia
    from myastrotools.gaia_tools import RUWE_u0, RUWE_u0_nocolor
    for source_id in source_ids:
        job = Gaia.launch_job(
            'SELECT * FROM gaiadr2.gaia_source WHERE source_id = ' + str(
            source_id))
        j = job.get_results()
        if np.isnan(j['bp_rp']):
            u0 = RUWE_u0_nocolor(np.array(j['phot_g_mean_mag']))
        else:
            u0 = RUWE_u0(g_mag=j['phot_g_mean_mag'], bp_rp=j['bp_rp'])
        u = np.sqrt(np.array(j['astrometric_chi2_al']) / (np.array(j[
            'astrometric_n_good_obs_al']) - 5))
        RUWE = u / u0
        print('For', source_id, 'RUWE=', RUWE[0])
