DR12 APOGEE Parameter Catalogs
Where to find APOGEE Parameters
Summary FITS tables giving parameters of all publicly released APOGEE objects
- allStar
- provides information for each individual star observed in APOGEE-1, which includes mean barycentric radial velocity, the standard deviation of the mean velocity, ASPCAP parameters and abundances as derived from the combined spectra, and a compilation of ancillary targeting data (for DR12, allStar-v603.fits )
- allVisit
- provides information for each individual visit of each star in APOGEE-1, which includes the barycentric radial velocity of each visit, along with a compilation of ancillary targeting data (for DR12, allVisit-v603.fits )
The Catalog Archive Server (CAS) database, which contains several tables with APOGEE information:
- apogeeVisit
- contains information about each visit to each object including the radial velocity of the visit and the information needed to locate visit spectra files (apVisit files) in the Science Archive Server (SAS);
- apogeeStar
- contains information about each observed object is stored including catalog information, derived average radial velocities, the standard deviation of the average radial velocities, a data quality flag, and the information needed to locate the combined spectra files (apStar files) in the SAS (also see the bulk download page).
- aspcapStar
- contains ASPCAP information about each observed object, including the derived stellar parameters, abundances, several data quality flags, and the information needed to locate the pseudocontinuum-normalized spectra and ASPCAP best fit spectra (aspcapStar files) in the SAS (also see the bulk download page).
- apogeeObject
- contains targeting information about all possible targets in each of the APOGEE fields. The APOGEE targets are selected from this master catalog according to the target selection algorithms.
Headers of FITS files with spectra of individual objects (apVisit, apStar and aspcapStar files; see the bulk download page).
Users are strongly encouraged to read the Using APOGEE parameters and the Using APOGEE abundances documentation before proceeding to analysis of the catalog information. In particular, users should be aware that:
- there are different target samples, as described in our target selection pages. The manner in which each target was selected can be determined by looking at the APOGEE_TARGET1 and APOGEE_TARGET2 target bitmasks, and/or the EXTRATARG bitmask.
- not all of the stellar parameters and abundances are reliable, and not all are calibrated; in particular, results for higher surface gravity stars (hot stars and dwarfs) are less reliable and uncalibrated and stellar parameters near a grid edge should be considered unreliable.
- there are several bitmasks that flag possible conditions with the derived quantity, in particular, the STARFLAG bitmask, the ASPCAPFLAG bitmask, and the PARAMFLAG and ELEMFLAG bitmasks. The examples below demonstrate how to use this information to obtain a set of objects.
Examples of selecting APOGEE data from catalogs
Here we include a number of examples of getting APOGEE data from the catalogs. These examples assume that you are either logged into CASJobs and using the DR12 context, or have downloaded the APOGEE catalog files. In the latter case, we assume you are using IDL with the latest version of idlutils (v5_5_11
or later) or python with numpy and pyfits available (for example, if you have installed astropy).
- Get all PLATES observed for a given LOCATION_ID
- Get ASPCAP parameters, element abundances and errors for all stars that were targeted as part of the main APOGEE survey
- Get element abundances for all stars with [Fe/H] < -2 with no BAD FLAGS set
- Get element abundances for stars flagged as known cluster members
- Get pm, JHK mag and errors, A_K and RV, for stars with abs(RVs) > 100 km/s with small RVscat and no BAD flags for RVs
- Get ASPCAP parameters and targeting flags for all stars with 1 degree of a cluster center
- Get RVs from individual visits and the element abundances for the combined spectra
- Get APOGEE_IDs and SDSS/BOSS plate, mjd, fiberid for all stars that have both APOGEE and SEGUE spectra
- Get SDSS ugriz photometry, errors and flags, ASPCAP parameters for the APOGEE stars with b > 60
Get all PLATES observed for a given LOCATION_ID
LOCATION_ID
). The stars in each field are observed multiple times on multiple visits, on different MJDs. These may involve one or more physical plugplates, and thus, the fiber number may change. Field names and IDs can be found in the index embedded in the SAS.
To find all the plate visits, one can search as follows (for LOCATION_ID
4105):
In CAS:
SELECT plate, mjd FROM apogeePlate WHERE location_id=4105
The same field can be searched by its name (in this case 'M13'):
SELECT plate, mjd FROM apogeePlate WHERE name = 'M13'
In IDL, using the allPlates
file (see the links on the APOGEE data page):
plates = mrdfits('allPlates-v603.fits', 1) ilocation = where(plates.location_id eq 4105, nlocation) print, plates[ilocation].plate print, plates[ilocation].mjd iname = where(strtrim(plates.name, 2) eq 'M13', nname) print, plates[ilocation].plate print, plates[ilocation].mjd
In python with pyfits
, using the allPlates
file (see the links on the APOGEE data page):
import pyfits plates_hdus = pyfits.open('allPlates-v603.fits') plates = plates_hdus[1].data plates_bylocation = plates[plates.field('LOCATION_ID') == 4105] print plates_bylocation.field('PLATE') print plates_bylocation.field('MJD') plates_byname = plates[plates.field('NAME') == 'M13'] print plates_byname.field('PLATE') print plates_byname.field('MJD')
Get ASPCAP parameters, element abundances and errors for all stars that were targeted as part of the main APOGEE survey
The stellar parameters are available for all stars that had ASPCAP run on them. However, this includes some results known to be bad as well as stars targeted as part of ancillary programs of various sorts. Restricting to the good main survey targets requires checking on flags as in the next example. Note that this returns calibrated quantities, which means that dwarfs will have values set to -9999. It is possible to get uncalibrated quantities as well, see the pages on Using parameters and Using abundances for the appropriate tag/column names.
In CAS, limiting to the first 100 (remove "TOP 100" to retrieve all the objects):
SELECT TOP 100 s.apogee_id, s.ra, s.dec, s.glon, s.glat, s.vhelio_avg, s.vscatter, a.teff, a.teff_err, a.logg, a.logg_err, a.param_m_h, a.param_m_h_err, a.param_alpha_m, a.param_alpha_m_err, a.c_h, a.c_h_err, a.n_h, a.n_h_err, a.o_h, a.o_h_err, a.na_h, a.na_h_err, a.mg_h, a.mh_h_err, a.al_h, a.al_h_err, a.si_h, a.si_h_err, a.s_h, a.s_h_err, a.k_h, a.k_h_err, a.ca_h, a.ca_h_err, a.ti_h, a.ti_h_err, a.v_h, a.v_h_err, a.mn_h, a.mn_h_err, a.fe_h, a.fe_h_err, a.ni_h, a.ni_h_err, dbo.fApogeeAspcapFlagN(a.aspcapflag), dbo.fApogeeStarFlagN(s.starflag) FROM apogeeStar s JOIN aspcapStar a on a.apstar_id = s.apstar_id WHERE (a.aspcapflag & dbo.fApogeeAspcapFlag('STAR_BAD')) = 0 and s.extratarg = 0
In IDL, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) badbits = sdss_flagval('APOGEE_ASPCAPFLAG', 'STAR_BAD') gd = where((star.aspcapflag and badbits) eq 0 and star.extratarg eq 0, ngd) for i=0, (ngd < 100)-1 do begin print, star[gd[i]].apogee_id print, star[gd[i]].ra, star[gd[i]].dec, star[gd[i]].glon, star[gd[i]].glat, $ star[gd[i]].vhelio_avg, star[gd[i]].vscatter, $ star[gd[i]].teff, star[gd[i]].teff_err, $ star[gd[i]].logg, star[gd[i]].logg_err, $ star[gd[i]].param_m_h, star[gd[i]].param_m_h_err, $ star[gd[i]].param_alpha_m, star[gd[i]].param_alpha_m_err, $ star[gd[i]].c_h, star[gd[i]].c_h_err, star[gd[i]].n_h, star[gd[i]].n_h_err, star[gd[i]].o_h, star[gd[i]].o_h_err, star[gd[i]].na_h, star[gd[i]].na_h_err, star[gd[i]].mg_h, star[gd[i]].mg_h_err, star[gd[i]].al_h, star[gd[i]].al_h_err, star[gd[i]].si_h, star[gd[i]].si_h_err, star[gd[i]].s_h, star[gd[i]].s_h_err, star[gd[i]].k_h, star[gd[i]].k_h_err, star[gd[i]].ca_h, star[gd[i]].ca_h_err, star[gd[i]].ti_h, star[gd[i]].ti_h_err, star[gd[i]].v_h, star[gd[i]].v_h_err, star[gd[i]].mn_h, star[gd[i]].mn_h_err, star[gd[i]].fe_h, star[gd[i]].fe_h_err, star[gd[i]].ni_h, star[gd[i]].ni_h_err, star[gd[i]].aspcapflags, star[gd[i]].starflags endfor
In python, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
import numpy import pyfits star_hdus = pyfits.open('allStar-v603.fits') star = star_hdus[1].data star_hdus.close() badbits = 2**23 gd = (numpy.bitwise_and(star['aspcapflag'], badbits) == 0) & (star['extratarg']==0) ind = numpy.where(gd)[0] for i in range(0, 100): j = ind[i] print star['ra'][j], star['dec'][j], star['glon'][j], star['glat'][j],\ star['vhelio_avg'][j], star['vscatter'][j],\ star['teff'][j], star['teff_err'][j],\ star['logg'][j], star['logg_err'][j],\ star['param_m_h'][j], star['param_m_h_err'][j],\ star['param_alpha_m'][j], star['param_alpha_m_err'][j],\ star['c_h'][j], star['c_h_err'][j],\ star['n_h'][j], star['n_h_err'][j],\ star['o_h'][j], star['o_h_err'][j],\ star['na_h'][j], star['na_h_err'][j],\ star['mg_h'][j], star['mg_h_err'][j],\ star['al_h'][j], star['al_h_err'][j],\ star['si_h'][j], star['si_h_err'][j],\ star['s_h'][j], star['s_h_err'][j],\ star['k_h'][j], star['k_h_err'][j],\ star['ca_h'][j], star['ca_h_err'][j],\ star['ti_h'][j], star['ti_h_err'][j],\ star['v_h'][j], star['v_h_err'][j],\ star['mn_h'][j], star['mn_h_err'][j],\ star['fe_h'][j], star['fe_h_err'][j],\ star['ni_h'][j], star['ni_h_err'][j],\ star['aspcapflags'][j], star['starflags'][j]
Get element abundances for all stars with [Fe/H] < -2 with no BAD FLAGS set
In CAS, limiting to the first 100:
SELECT TOP 100 s.apogee_id, s.ra, s.dec, s.glon, s.glat, s.vhelio_avg, s.vscatter, a.teff, a.logg, a.param_m_h, a.param_alpha_m, dbo.fApogeeAspcapFlagN(a.aspcapflag), dbo.fApogeeStarFlagN(s.starflag) FROM apogeeStar s JOIN aspcapStar a on a.apstar_id = s.apstar_id WHERE (a.aspcapflag & dbo.fApogeeAspcapFlag('STAR_BAD')) = 0 and a.teff > 0 and a.param_m_h < -2
In IDL, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) badbits = sdss_flagval('APOGEE_ASPCAPFLAG', 'STAR_BAD') gd = where((star.aspcapflag and badbits) eq 0 and star.teff gt 0 $ and star.param_m_h lt -2, ngd) for i=0,(ngd < 100)-1 do begin print, star[gd[i]].apogee_id,$ star[gd[i]].ra, star[gd[i]].dec, star[gd[i]].glon, star[gd[i]].glat,$ star[gd[i]].vhelio_avg, star[gd[i]].vscatter, star[gd[i]].teff,$ star[gd[i]].logg, star[gd[i]].param_m_h, star[gd[i]].param_alpha_m,$ star[gd[i]].aspcapflags, star[gd[i]].starflags endfor
In python, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
import numpy import pyfits star_hdus = pyfits.open('allStar-v603.fits') star = star_hdus[1].data star_hdus.close() badbits = 2**23 gd = (numpy.bitwise_and(star['aspcapflag'], badbits) == 0) & (star['teff']>0)\ & (star['param_m_h'] < -2.) ind = numpy.where(gd)[0] for i in range(0, 100): j = ind[i] print star['ra'][j], star['dec'][j], star['glon'][j], star['glat'][j],\ star['vhelio_avg'][j], star['vscatter'][j], star['teff'][j], star['logg'][j],\ star['param_m_h'][j], star['param_alpha_m'][j], star['aspcapflags'][j],\ star['starflags'][j]
Get element abundances for stars flagged as known cluster members
APOGEE_CALIB_CLUSTER
) but were not observed during commissioning.
In CAS:
SELECT TOP 100 s.apogee_id, s.ra, s.dec, s.glon, s.glat, s.vhelio_avg, s.vscatter, a.teff, a.teff_err, a.logg, a.logg_err, a.param_m_h, a.param_m_h_err, a.param_alpha_m, a.param_alpha_m_err, dbo.fApogeeAspcapFlagN(a.aspcapflag), dbo.fApogeeStarFlagN(s.starflag) FROM apogeeStar s JOIN aspcapStar a on a.apstar_id = s.apstar_id WHERE (a.aspcapflag & dbo.fApogeeAspcapFlag('STAR_BAD')) = 0 and s.commiss = 0 and (s.apogee_target2 & (dbo.fApogeeTarget2('APOGEE_CALIB_CLUSTER')) != 0)
In IDL, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) badbits = sdss_flagval('APOGEE_ASPCAPFLAG', 'STAR_BAD') clusterbits = sdss_flagval('APOGEE_TARGET2', 'APOGEE_CALIB_CLUSTER') gd = where((star.aspcapflag and badbits) eq 0 and star.commiss eq 0 and $ (star.apogee_target2 and clusterbits) ne 0, ngd) for i=0,(ngd<100)-1 do begin print, star[gd[i]].apogee_id,$ star[gd[i]].ra, star[gd[i]].dec, star[gd[i]].glon, star[gd[i]].glat,$ star[gd[i]].vhelio_avg, star[gd[i]].vscatter, star[gd[i]].teff,$ star[gd[i]].logg, star[gd[i]].param_m_h, star[gd[i]].param_alpha_m,$ star[gd[i]].aspcapflags, star[gd[i]].starflags endfor
In python, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
import numpy import pyfits star_hdus = pyfits.open('allStar-v603.fits') star = star_hdus[1].data star_hdus.close() badbits = 2**23 clusterbits= 2**10 gd = (numpy.bitwise_and(star['aspcapflag'], badbits) == 0) &\ (numpy.bitwise_and(star['apogee_target2'], clusterbits) != 0) &\ (star['commiss'] == 0) ind = numpy.where(gd)[0] for i in range(0, 100): j = ind[i] print star['ra'][j], star['dec'][j], star['glon'][j], star['glat'][j],\ star['vhelio_avg'][j], star['vscatter'][j], star['teff'][j],\ star['logg'][j], star['param_m_h'][j], star['param_alpha_m'][j],\ star['aspcapflags'][j], star['starflags'][j]
Get proper motions, JHK mag and errors, K-band extinction and radial velocities, for stars with RVs > 300 km/s (with no BAD flags for RVs).
There is photometric data associated with each target, including proper motions and other information. This example looks for such information for larger (heliocentric) radial velocity stars. It restricts to objects with good measured ASPCAP parameters. In CAS, this requires joining the apogeeStar
and aspcapStar
tables with the apogeeObject
table, which has the target information. In the flat-files, enough of the target information is included in the allStar
file in this case.
In CAS:
SELECT TOP 100 star.apogee_id, star.ra, star.dec, star.glon, star.glat, star.vhelio_avg, star.vscatter, obj.j, obj.h, obj.k, obj.ak_targ, obj.ak_targ_method, obj.ak_wise, aspcap.teff, aspcap.logg, aspcap.param_m_h FROM apogeeStar star JOIN aspcapStar aspcap on aspcap.apstar_id = star.apstar_id JOIN apogeeObject obj on aspcap.target_id = obj.target_id WHERE (aspcap.aspcapflag & dbo.fApogeeAspcapFlag('STAR_BAD')) = 0 and aspcap.teff > 0 and (star.vhelio_avg > 300) and (star.starflag & dbo.fApogeeStarFlag('SUSPECT_RV_COMBINATION')) = 0 and star.nvisits > 2 order by aspcap.apogee_id
In IDL, printing first 100 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) badbits = sdss_flagval('APOGEE_ASPCAPFLAG', 'STAR_BAD') suspectbits = sdss_flagval('APOGEE_STARFLAG', 'SUSPECT_RV_COMBINATION') gd = where((star.aspcapflag and badbits) eq 0 $ and (star.starflag and suspectbits) eq 0 $ and (star.vhelio_avg gt 300.) and (star.teff gt 0.) $ and (star.nvisits gt 2), ngd) for i=0,(ngd<100)-1 do begin print, star[gd[i]].apogee_id,$ star[gd[i]].ra, star[gd[i]].dec, star[gd[i]].glon, star[gd[i]].glat,$ star[gd[i]].vhelio_avg, star[gd[i]].vscatter, star[gd[i]].teff,$ star[gd[i]].logg, star[gd[i]].param_m_h, star[gd[i]].param_alpha_m,$ star[gd[i]].aspcapflags, star[gd[i]].starflags endfor
In python, printing first 10 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
import numpy import pyfits star_hdus = pyfits.open('allStar-v603.fits') star = star_hdus[1].data star_hdus.close() badbits = 2**23 suspectbits = 2**16 gd = (numpy.bitwise_and(star['aspcapflag'], badbits) == 0) &\ (numpy.bitwise_and(star['starflag'], suspectbits) == 0) &\ (star['vhelio_avg'] > 300.) &\ (star['teff'] > 0.) &\ (star['nvisits'] > 2) ind = numpy.where(gd)[0] for i in range(0, 10): j = ind[i] print star['ra'][j], star['dec'][j], star['glon'][j], star['glat'][j],\ star['vhelio_avg'][j], star['vscatter'][j], star['teff'][j],\ star['logg'][j], star['param_m_h'][j], star['param_alpha_m'][j],\ star['aspcapflags'][j], star['starflags'][j]
Get ASPCAP parameters and targeting flags for all stars with 1 degree of a cluster center.
In CAS, using Equatorial coordinates:
SELECT star.apstar_id, star.apogee_id, star.ra, star.dec, star.glon, star.glat, star.apogee_target1, star.apogee_target2, aspcap.teff, aspcap.logg, aspcap.param_m_h FROM apogeeStar star JOIN fGetNearbyApogeeStarEq(250.423458,36.461306,60) near on star.apstar_id=near.apstar_id JOIN aspcapStar aspcap on aspcap.apstar_id=star.apstar_id
In IDL, using the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) ra_m13 = 250.423458 dec_m13 = 36.461306 istar = where(star.ra gt 0. and star.dec gt -90., nstar) spherematch, ra_m13, dec_m13, star[istar].ra, star[istar].dec, 1., m1, m2, max=0 stars_near_m13 = star[m2]
Get RVs from individual visits and the element abundances for the combined spectra for stars which have more than 6 visits.
Each star is visited several times, and in some case many times, in order to build up signal-to-noise and to detect radial velocity variations. The information about each visit to each star is in the apogeeVisit
table. One could join this table with apogeeStar
on apogee_id
in order to literally find all visits to each star. However, in this example we are interested in just finding those visits that actually contributed to each combined spectrum. In this case, bad visits are excluded and commissioning data and survey data are kept separate (not combined). To find these stars, one may use the apogeeStarVisit
table in CAS, or the array visit_pk
which exists for each star in the allStar
file. Alternatively, if you wanted to find all visits to a particular star, one could replace in the code below apogeeStarVisit
with apogeeStarAllVisit
and visit_pk
with all_visit_pk
.
In CAS:
SELECT top 100 visit.*, aspcap.teff, aspcap.logg, aspcap.param_m_h FROM apogeeVisit visit JOIN apogeeStarVisit starvisit on visit.visit_id = starvisit.visit_id JOIN aspcapStar aspcap on aspcap.apstar_id = starvisit.apstar_id JOIN apogeeStar star on star.apstar_id = starvisit.apstar_id WHERE (aspcap.aspcapflag & dbo.fApogeeAspcapFlag('STAR_BAD')) = 0 and aspcap.teff > 0 and (star.apogee_target1 & dbo.fApogeeTarget1('APOGEE_LONG')) > 0 and star.nvisits > 6 ORDER BY visit.apogee_id
In IDL. This uses the allStar
file (see the links on the APOGEE data page):
star = mrdfits('allStar-v603.fits', 1) visit = mrdfits('allVisit-v603.fits', 1) badbits = sdss_flagval('APOGEE_ASPCAPFLAG', 'STAR_BAD') longbits = sdss_flagval('APOGEE_TARGET1', 'APOGEE_LONG') gd = where((star.aspcapflag and badbits) eq 0 and $ (star.apogee_target1 and longbits) ne 0 $ and (star.nvisits gt 6) and (star.teff gt 0.), ngd) for i=0L, (ngd<100)-1L do begin for j=0L, star[gd[i]].nvisits-1L do begin print, visit[star[gd[i]].visit_pk[j]].target_id + " " + $ visit[star[gd[i]].visit_pk[j]].visit_id endfor endfor
In python, printing first 10 stars it finds. This uses the allStar
file (see the links on the APOGEE data page):
import numpy import pyfits star_hdus = pyfits.open('allStar-v603.fits') star = star_hdus[1].data star_hdus.close() visit_hdus = pyfits.open('allVisit-v603.fits') visit = visit_hdus[1].data visit_hdus.close() badbits = 2**23 longbits = 2**13 gd = (numpy.bitwise_and(star['aspcapflag'], badbits) == 0) &\ (numpy.bitwise_and(star['apogee_target1'], longbits) != 0) &\ (star['teff'] > 0.) &\ (star['nvisits'] > 6) ind = numpy.where(gd)[0] for i in range(0, 100): k = ind[i] vpk = star['visit_pk'][k] for j in range(0, star['nvisits'][k]): print visit['target_id'][vpk[j]] + " " + visit['visit_id'][vpk[j]]
Get APOGEE_IDs and SDSS/BOSS plate, mjd, fiberid for all stars that have both APOGEE and SEGUE spectra.
A small number of objects have been observed both in the optical with the SDSS and/or BOSS spectrographs and in the infrared with the APOGEE spectrograph. The examples below finds all matches between primary SDSS/BOSS spectra and APOGEE stars with a 3 arcsec tolerance for such cases (note that there are some cases where an entry in one catalog matches multiple entries in the other).
In CAS, using a special function:
SELECT TOP 50 specobj.plate as specobj_plate, specobj.mjd as specobj_mjd, specobj.fiberid as specobj_fiberid, specobj.ra as specobj_ra, specobj.dec as specobj_dec, star.apstar_id, star.ra as star_ra, star.dec as star_dec FROM apogeeStar AS star CROSS APPLY dbo.fGetNearestSpecObjEq( star.ra, star.dec, 0.05) AS near JOIN specobj ON near.specobjid=specobj.specobjid
In IDL. This uses the allStar
file (see the links on the APOGEE data page) and also the unfortunately large specObj
file for the SDSS/BOSS data (see the optical spectroscopic data access documentation).
star = mrdfits('allStar-v603.fits', 1) specobj = hogg_mrdfits(getenv('SPECTRO_REDUX') + '/specObj-dr10.fits', 1, nrow=20000,$ columns = ['plate', 'fiberid', 'mjd', 'plug_ra', 'plug_dec', 'specprimary']) iprimary = where(specobj.specprimary eq 1, nprimary) spherematch, star.ra, star.dec,$ specobj[iprimary].plug_ra, specobj[iprimary].plug_dec,$ 3./3600., m1, m2, max=0 star_match = star[m1] specobj_match = specobj[iprimary[m2]]
Get SDSS ugriz photometry, errors and flags, ASPCAP parameters for the APOGEE stars with b > 60
In addition to matching to the SDSS spectroscopy, you can also match to the SDSS photometric imaging data. In this case, we only give an example within CAS. To do this purely with flat files requires either downloading the full photometric catalog (about 3 Tbytes) or the "datasweep" files (about 300 Gbytes), both described in the imaging data access documentation, and constructing an efficient flat-file method to do the matching. For most purposes, CAS will be the right way to do this.
In CAS, using a special function:
SELECT TOP 50 photoobj.run, photoobj.camcol, photoobj.field, photoobj.obj, photoobj.psfmag_u, photoobj.psfmag_g, photoobj.psfmag_r, photoobj.psfmag_i, photoobj.psfmag_z, photoobj.ra as photoobj_ra, photoobj.dec as photoobj_dec, star.apstar_id, star.ra as star_ra, star.dec as star_dec, aspcap.teff, aspcap.param_m_h, aspcap.logg FROM apogeeStar AS star CROSS APPLY dbo.fGetNearestObjEq( star.ra, star.dec, 0.05) AS near JOIN photoobj ON near.objid=photoobj.objid JOIN aspcapStar as aspcap ON star.apstar_id = aspcap.apstar_id WHERE star.glat > 60. and aspcap.teff > 0