def build_query(self, version_id, query_region=None): l = Gaia_DR2.l # noqa b = Gaia_DR2.b # Dense regions (Galactic plane, SMC, LMC). gal_cut = ( ((l <= 180) & (b < (-0.139 * l + 25)) & (b > (0.139 * l - 25))) | # noqa ((l > 180) & (b > (-0.139 * l + 25)) & (b < (0.139 * l - 25))) | (fn.sqrt(fn.pow(l - 303.2, 2) + 2 * fn.pow(b + 44.4, 2)) < 5) | (fn.sqrt(fn.pow(l - 280.3, 2) + 2 * fn.pow(b + 33.0, 2)) < 8)) query = (Gaia_DR2.select( CatalogToTIC_v8.catalogid, TIC_v8.gaia_int.alias('gaia_source_id'), Gaia_DR2.phot_g_mean_mag, l, b).join(TIC_v8).join(CatalogToTIC_v8).where( (Gaia_DR2.parallax - Gaia_DR2.parallax_error) > 10, ((Gaia_DR2.astrometric_excess_noise < 2) & gal_cut) | ~(gal_cut)).where(CatalogToTIC_v8.version_id == version_id, CatalogToTIC_v8.best >> True)) if query_region: query = (query.join_from(CatalogToTIC_v8, Catalog).where( fn.q3c_radial_query(Catalog.ra, Catalog.dec, query_region[0], query_region[1], query_region[2]))) return query
def build_query(self, version_id, query_region=None): km = TwoMassPSC.k_m hm = TwoMassPSC.h_m jm = TwoMassPSC.j_m Gm = Gaia_DR2.phot_g_mean_mag query = (CatalogToTIC_v8.select( CatalogToTIC_v8.catalogid, Gaia_DR2.parallax, Gaia_DR2.source_id.alias('gaia_source_id'), km.alias('ks_m')).join(TIC_v8).join(Gaia_DR2).join( Gaia_DR2_RUWE, on=(Gaia_DR2.source_id == Gaia_DR2_RUWE.source_id)).join( TMBN, on=(TMBN.source_id == Gaia_DR2_RUWE.source_id)).join( TwoMassPSC, on=(TMBN.tmass_pts_key == TwoMassPSC.pts_key)).where( CatalogToTIC_v8.version_id == version_id, CatalogToTIC_v8.best >> True).where( Gaia_DR2.parallax < fn.pow( 10, ((10. - km - 0.61) / 5.)), Gm < 16., jm - km - 0.25 * (Gm - km) < 0.10, jm - km - 0.25 * (Gm - km) > -0.30, jm - hm < 0.15 * (Gm - km) + 0.05, jm - hm > 0.15 * (Gm - km) - 0.15, jm - km < 0.23 * (Gm - km) + 0.03, Gm > 2 * (Gm - km) + 3.0, TMBN.angular_distance < 1.)) if query_region: query = (query.join_from(CatalogToTIC_v8, Catalog).where( peewee.fn.q3c_radial_query(Catalog.ra, Catalog.dec, query_region[0], query_region[1], query_region[2]))) return query
def build_query(self, version_id, query_region=None): colour_cuts = (fuv_magerr < 0.2, nuv_magerr < 0.2, fuv_mag > -100, nuv_mag > -100, colour_absg, (absg > -1.11749253e-03 * fn.pow(fuv_nuv, 3) + 1.53748615e-02 * fn.pow(fuv_nuv, 2) + 3.66419895e-01 * fuv_nuv + 2.20026639), ((fuvg < 6.08) | ((fuvg < 11.82 * B_AB_R_AB + 2.58) & (fuvg < -0.79 * B_AB_R_AB + 9.21)))) query = (GUVCat.select( CatalogToTIC_v8.catalogid, Gaia_DR2.source_id, Gaia_DR2.ra.alias('gaia_ra'), Gaia_DR2.dec.alias('gaia_dec'), Gaia_DR2.pmra, Gaia_DR2.pmdec, Gaia_DR2.pmra_error, Gaia_DR2.pmdec_error, Gaia_DR2.parallax, Gaia_DR2.parallax_error, Gaia_DR2.phot_g_mean_mag, Gaia_DR2.phot_bp_mean_mag, Gaia_DR2.phot_rp_mean_mag, BJ.r_est, BJ.r_lo, GUVCat.objid.alias('guvcat_objid'), GUVCat.ra.alias('guvcat_ra'), GUVCat.dec.alias('guvcat_dec'), GUVCat.nuv_mag, GUVCat.fuv_mag, GUVCat.nuv_magerr, GUVCat.fuv_magerr).join(CatalogToGUVCat).join( CatalogToTIC_v8, on=(CatalogToGUVCat.catalogid == CatalogToTIC_v8.catalogid )).join(TIC_v8).join(Gaia_DR2).join(BJ).where( CatalogToTIC_v8.version_id == version_id, CatalogToTIC_v8.best >> True).where( CatalogToGUVCat.version_id == version_id, CatalogToGUVCat.best >> True).where( Gaia_DR2.visibility_periods_used > 5).where( *colour_cuts).where(*astrometric_cuts)) if query_region: query = (query.join_from(CatalogToTIC_v8, Catalog).where( peewee.fn.q3c_radial_query(Catalog.ra, Catalog.dec, query_region[0], query_region[1], query_region[2]))) return query
def build_query(self, version_id, query_region=None): bmr = Gaia_DR2.phot_bp_mean_mag - Gaia_DR2.phot_rp_mean_mag GMS = (0.00206868742 * fn.pow(bmr, 6) + 0.0401594518 * fn.pow(bmr, 5) - 0.842512410 * fn.pow(bmr, 4) + 4.89384979 * fn.pow(bmr, 3) - 12.3826637 * fn.pow(bmr, 2) + 17.0197205 * bmr - 3.19987835) colour_cuts = (TwoMassPSC.h_m < 15, fn.abs(GMS - absg) <= 0.5, absg >= 4.0866, BJ.r_est < 0.51 * fn.pow(10, 0.2291 * Gaia_DR2.phot_g_mean_mag)) query = (GUVCat.select( CatalogToTIC_v8.catalogid, Gaia_DR2.source_id, Gaia_DR2.ra.alias('gaia_ra'), Gaia_DR2.dec.alias('gaia_dec'), Gaia_DR2.pmra, Gaia_DR2.pmdec, Gaia_DR2.pmra_error, Gaia_DR2.pmdec_error, Gaia_DR2.parallax, Gaia_DR2.parallax_error, Gaia_DR2.phot_g_mean_mag, Gaia_DR2.phot_bp_mean_mag, Gaia_DR2.phot_rp_mean_mag, BJ.r_est, BJ.r_lo, GUVCat.objid.alias('guvcat_objid'), GUVCat.ra.alias('guvcat_ra'), GUVCat.dec.alias('guvcat_dec'), GUVCat.nuv_mag, GUVCat.fuv_mag, GUVCat.nuv_magerr, GUVCat.fuv_magerr, GMS.alias('GMS'), TwoMassPSC.ra, TwoMassPSC.decl, TwoMassPSC.h_m, TwoMassPSC.pts_key).join(CatalogToGUVCat).join( CatalogToTIC_v8, on=(CatalogToGUVCat.catalogid == CatalogToTIC_v8.catalogid)). join(TIC_v8).join(TwoMassPSC).join_from( TIC_v8, Gaia_DR2).join(BJ).where( CatalogToTIC_v8.version_id == version_id, CatalogToTIC_v8.best >> True).where( CatalogToGUVCat.version_id == version_id, CatalogToGUVCat.best >> True).where( Gaia_DR2.visibility_periods_used > 5).where( fuv_magerr < 0.2, nuv_magerr < 0.2, fuv_mag > -100, nuv_mag > -100).where(*colour_cuts).where( *astrometric_cuts)) if query_region: query = (query.join_from(CatalogToTIC_v8, Catalog).where( peewee.fn.q3c_radial_query(Catalog.ra, Catalog.dec, query_region[0], query_region[1], query_region[2]))) return query
def getDist(self, lat, lon, obj): return fn.pow(fn.pow(obj.latitude - lat, 2) + fn.pow(obj.longitude - lon, 2), 0.5)
fuvg = fuv_mag - gmagab B_AB = Gaia_DR2.phot_bp_mean_mag - 25.351 + 25.386 R_AB = Gaia_DR2.phot_rp_mean_mag - 24.762 + 25.116 B_AB_R_AB = B_AB - R_AB colour_absg = ((absg > 4.09) | (absg > 4.5457 * bp_rp + 4.0457)) pmra = Gaia_DR2.pmra pmdec = Gaia_DR2.pmdec pmra_error = Gaia_DR2.pmra_error pmdec_error = Gaia_DR2.pmdec_error pm = fn.sqrt(pmra * pmra + pmdec * pmdec) pm_error = fn.sqrt( fn.pow((pmra_error * pmra / pm), 2) + fn.pow((pmdec_error * pmdec / pm), 2)) logpmdpm = fn.log(pm / pm_error) epar = Gaia_DR2.parallax / Gaia_DR2.parallax_error astrometric_cuts = (BJ.r_lo <= 1500, ~(((logpmdpm < 0.301) & (epar > -1.4995 * logpmdpm - 4.05) & (epar < 1.4995 * logpmdpm + 4.05)) | (fn.pow((logpmdpm - 0.301), 2) / (0.39794 * 0.39794) + fn.pow(epar, 2) / (4.5 * 4.5) <= 1))) class MWM_CB_UVEX_BaseCarton(BaseCarton): def post_process(self, model, **kwargs):