pro obsdiagnos,jd,filter,exptime,mag,sky,sharp,chi,dra,ddec,ra,dec,ra2m,dec2m,$ j2m,k2m,x,diags,diagnames,ver,zdb=zdb ; This routine generates a number of diagnostics diags of the quality of ; the data in an input image by manipulating the image data vectors ; mag, sky, sharp, chi, dra, ddec. ; Results are returned in floating array diags, with descriptive names ; in the string array diagnames, and corresp version number in string ver. ; Since it is intended that the list of diagnostics may vary as experience ; dictates, the individual diagnostics are explained individually at the ; top of the corresponding code sections. ; keyword zdb is passed along to rd_global ver=2 diagnames=['skybright','dif2MASS','sharp_med','chi_12','chi_14','chi_16',$ 'pos_rms','n_unmatch'] ndiags=n_elements(diagnames) diags=fltarr(ndiags) ii=0 icam=icamera(jd(0)) > 1 icam=icam-1 ; which camera? 0=4-shooter, 1=minicam, 2=keplercam ; find filter nfilt=7 filts=['u','g','r','i','z','gred','d51'] ; possible filter names ifilt=-1 ff=strlowcase(strtrim(filter,2)) for i=0,nfilt-1 do begin if(ff eq filts(i)) then ifilt=i endfor exp0=20. ; nominal exposure time (s) ; sky_brightness estimate, nominally scaled to 1. for dark sky in all filters. scale=[.188,.015,.006,.0045,.0035,.172,.089] ; scale factor to equalize filters. ee0=200. ; nominal e- in sky for exptime=exp0 if(ifilt ge 0) then begin ssky=sky*scale(ifilt)*ee0/(exp0*exptime) diags(ii)=median(ssky) endif else begin diags(ii)=0. endelse ii=ii+1 ; 5th percentile magnitude offset=[3.5,2.26,2.19,2.66,3.41,4.90,4.41] ; offsets for nominal exposure time ; empirically determined maga=mag-offset(ifilt) ; adjusted magnitude so=sort(maga) som=maga(so) nst=n_elements(mag) maxmag=som(0.05*nst-1) ;diags(ii)=maxmag ; Difference between obsd and 2mass mags, for stars with J-K ~ 0.4 rcap=3. ; capture radius in arcsec radian=180.0/!pi d0=[3.053,1.648,1.221,1.011,0.889,2.004,1.545] d1=[3.544,1.854,1.023,0.627,0.336,2.781,1.699] d0a=[[0.,-.023,-.025,-.085,-.154,-.02,-.086],$ ; adjustments for each camera [0.,-.023,-.025,-.085,-.154,-.02,-.086],$ ; these are set empirically [0.,-.023,-.025,-.085,-.154,-.02,-.086]] d0adj=d0+d0a(*,icam) ; adjusted d0 values rd_global,jd(0),gnfilt,gfilt_names,gparms,geparms,chipz,cosmic,xglob,zdb=zdb s=where(j2m gt 0 and j2m lt 15 and (j2m-k2m) ge 0.35 and (j2m-k2m) le .45,ns) if(ns ge 3 and ifilt ge 0) then begin ; for each 2MASS star with a good color, find matching 4-shooter star mdif=[0.] nmat=0 for i=0,ns-1 do begin jj=s(i) cdec=cos(dec2m(jj)*radian) deldec=3600.*(dec-dec2m(jj)) delra=15.*3600.*cdec*(ra-ra2m(jj)) rr=sqrt(deldec^2+delra^2) minrr=min(rr,ix) if(minrr le rcap) then begin magdif=mag(ix)-j2m(jj)-d0adj(ifilt)-d1(ifilt)*(j2m(jj)-k2m(jj)-0.4)-$ geparms(0,ifilt)-(x(ix)-xglob)*geparms(1,ifilt) mdif=[mdif,magdif] nmat=nmat+1 endif endfor if(nmat ge 1) then begin mdif=mdif(1:*) if(nmat ge 3) then mav=median(mdif) else mav=total(mdif)/nmat endif else mav=0. endif else mav=0. diags(ii)=mav ii=ii+1 ; median sharp value sharp_med=median(sharp) diags(ii)=sharp_med ii=ii+1 ; median chi for stars with min adjusted magnitudes of 12.5, 14.5, 16.5 s12=where(maga le 12.5,ns12) if(ns12 gt 3) then chi12=median(chi(s12)) else chi12=0. s14=where(maga gt 12.5 and maga le 14.5,ns14) if(ns14 gt 3) then chi14=median(chi(s14)) else chi14=0. s16=where(maga gt 14.5 and maga le 16.5,ns16) if(ns16 gt 3) then chi16=median(chi(s16)) else chi16=0. diags(ii)=chi12 & ii=ii+1 diags(ii)=chi14 & ii=ii+1 diags(ii)=chi16 & ii=ii+1 ; rms positional error, for stars that match a (usually 2MASS) star sp=where(maga le 14.5 and (dra ne 0. or ddec ne 0.),nsp) if(nsp gt 0) then begin poserr2=dra(sp)^2+ddec(sp)^2 pos_rms=sqrt(total(poserr2)/nsp) diags(ii)=pos_rms & ii=ii+1 endif else begin diags(ii)=0. & ii=ii+1 endelse ; number of unmatched stars for adjusted mag le 14.5 spu=where(maga le 14.5 and dra eq 0. and ddec eq 0.,nspu) diags(ii)=nspu & ii=ii+1 end