Cross-matching SDSS and Gaia Data

I want to cross-match SDSS SEGUE stars with the Gaia DR3 data set to create photometric parallax models for DP0.2. I’m just starting to look at the Gaia tutorials, but I think the NOIR Astrolab has what I want. I’d appreciate any suggestions.

From Mark Taylor:
I’m no SDSS expert but it looks like this match has already been done between SDSS DR17 and Gaia DR3; the following ADQL query to the Noirlab TAP service seems to do the job (as long as your distance constraint is less than 1.5 arcsec):
select *
from sdss_dr17.x1p5__specobj__gaia_dr3__gaia_source as j
join sdss_dr17.specobj as specobj on j.id1 = specobj.specobjid
join gaia_dr3.gaia_source as gaia on j.id2 = gaia.source_id
where j.“distance”<0.3
The resulting table is rather wide, so specifying only the columns you want rather than SELECT * would be a good idea. The ESA Gaia TAP service has a similar match table between Gaia DR3 and SDSS DR13. You can do this using TOPCAT’s tap client, as noted at; maybe also using the interfaces on the datalab web pages.

Thank you Mark, I’ll try it!

Thank you again, Mark (and Robert Nikutta). I needed to join three tables instead of two, and with help from the two of you, the following query now works on the NOIR Astro DataLab. This community is so supportive!

query = “”"
SELECT s.bestobjid, s.specobjid, s.ra, s.dec, s.glon, s.glat, s.class, s.elodieteff,
s.elodiefeh, s.elodielogg,
g.source_id, g.designation, g.ra, g.dec, g.l, g.b, g.parallax, g.teff_gspphot,
g.mh_gspphot, g.logg_gspphot, g.rv_template_teff, g.rv_template_fe_h,
p.objid, p.ra, p.dec, p.l, p.b, p.clean, p.score, p.type, p.type_u, p.type_g,
p.type_r, p.type_i, p.type_z, p.psfmag_u, p.psfmag_g, p.psfmag_r, p.psfmag_i,
p.psfmagerr_i, p.psfmagerr_z, p.probpsf, p.probpsf_u, p.probpsf_g, p.probpsf_r,
p.probpsf_i, p.probpsf_z, p.lnlstar_u, p.lnlstar_g, p.lnlstar_r, p.lnlstar_i,
FROM sdss_dr17.x1p5__specobj__gaia_dr3__gaia_source as j
JOIN sdss_dr17.specobj as s ON j.id1 = s.specobjid
JOIN gaia_dr3.gaia_source as g ON j.id2 = g.source_id
JOIN sdss_dr17.photoplate as p ON s.bestobjid = p.objid
WHERE p.clean= 1 AND p.type=6 AND g.teff_gspphot >2000. AND
LIMIT 10"""
result = qc.query(sql=query, fmt=‘pandas’)

1 Like