;+ ; NAME: ; fls_irac_match ; PURPOSE: ; Match up Spitzer FLS IRAC source photometry with the VAGC etc. ; BUGS: ; - Not written ; - Incomplete header ; REVISION HISTORY: ; 2004-05-25 started - Hogg ;- pro fls_irac_match ; read in resolved IRAC photometry infilename= 'fls_irac_resolve.fits' splog, 'reading '+infilename resolve= mrdfits(infilename,1) ; read in VAGC quantities of relevance and match infilename= getenv('VAGC_REDUX')+'/object_catalog.fits' splog, 'reading '+infilename vagc= hogg_mrdfits(infilename,1,nrowchunk=288000, $ columns=['RA','DEC','SDSS_IMAGING_POSITION', $ 'TWOMASS_POSITION','SDSS_SPECTRO_POSITION']) matchlength= 1.0/3.6D3 spherematch, resolve.ra,resolve.dec,vagc.ra,vagc.dec,matchlength, $ match1,match2,maxmatch=1 resolve= resolve[match1] vagc= vagc[match2] nobj= n_elements(match2) infilename= getenv('VAGC_REDUX')+'/object_sdss_imaging.fits' splog, 'reading '+infilename sdssim= mrdfits(infilename,1,rows=match2[0]) for ii=1L,nobj-1L do sdssim= [sdssim,mrdfits(infilename,1,rows=match2[ii], $ /silent)] infilename= getenv('VAGC_REDUX')+'/object_sdss_spectro.fits' splog, 'reading '+infilename sdsssp= mrdfits(infilename,1,rows=match2[0]) for ii=1L,nobj-1L do sdsssp= [sdsssp,mrdfits(infilename,1,rows=match2[ii], $ /silent)] calibobj= retrieve_calibobj(sdssim) infilename= getenv('VAGC_REDUX')+'/sersic/sersic_catalog.fits' splog, 'reading '+infilename sersic= mrdfits(infilename,1,rows=match2[0]) for ii=1L,nobj-1L do sersic= [sersic,mrdfits(infilename,1,rows=match2[ii], $ /silent)] infilename= getenv('VAGC_REDUX')+'/kcorrect/kcorrect.none.petro.z0.10.fits' splog, 'reading '+infilename kcorrect= mrdfits(infilename,1,rows=match2[0]) for ii=1L,nobj-1L do kcorrect= [kcorrect,mrdfits(infilename,1,rows=match2[ii], $ /silent)] ; read in Tremonti results, match, and zero out non-matches infilename= '../../data/tremonti/spectro_blanton_dr2.fit.gz' splog, 'reading '+infilename tremonti= mrdfits(infilename,1) tremonti1= tremonti[0] for tt=0,n_tags(tremonti1)-2 do tremonti1.(tt)= 0 tremonti1= replicate(tremonti1,nobj) spherematch, resolve.ra,resolve.dec,tremonti.ra,tremonti.dec,matchlength, $ match1,match2,maxmatch=1 tremonti1[match1]= tremonti[match2] tremonti= tremonti1 infilename= '../../data/tremonti/gal_oh_dr2.v5_0.fit.gz splog, 'reading '+infilename metals= mrdfits(infilename,1) metals1= metals[0] for tt=0,n_tags(metals1)-1 do metals1.(tt)= 0 metals1= replicate(metals1,nobj) tre= where(tremonti.plateid GT 0,ntre) for ii=0L,ntre-1L do begin this= where((metals.plateid EQ tremonti[tre[ii]].plateid) AND $ (metals.mjd EQ tremonti[tre[ii]].mjd) AND $ (metals.fiberid EQ tremonti[tre[ii]].fiberid),nthis) if (nthis EQ 1) then begin metals1[tre[ii]]= metals[this] endif else if (nthis GT 1) then $ splog, 'warning: multiple matches found in metals!' endfor metals= metals1 infilename= '/global/data/eplusa/plate_loop.fits' splog, 'reading '+infilename eplusa= mrdfits(infilename,1) eplusa1= eplusa[0] for tt=0,n_tags(eplusa1)-1 do eplusa1.(tt)= 0 eplusa1= replicate(eplusa1,nobj) tre= where(sdsssp.plate GT 0,ntre) for ii=0L,ntre-1L do begin this= where((eplusa.plate EQ sdsssp[tre[ii]].plate) AND $ (eplusa.mjd EQ sdsssp[tre[ii]].mjd) AND $ (eplusa.fiber EQ sdsssp[tre[ii]].fiberid),nthis) if (nthis EQ 1) then begin eplusa1[tre[ii]]= eplusa[this] endif else if (nthis GT 1) then $ splog, 'warning: multiple matches found in eplusa!' endfor eplusa= eplusa1 ; write file outfilename= 'fls_irac_match.fits' splog, 'writing '+outfilename mwrfits, resolve, outfilename,/create mwrfits, sdssim, outfilename mwrfits, sdsssp, outfilename mwrfits, calibobj,outfilename mwrfits, sersic, outfilename mwrfits, kcorrect,outfilename mwrfits, tremonti,outfilename mwrfits, metals, outfilename mwrfits, eplusa, outfilename return end