PRO rd_sdss_q, fname, nstar,rad,decd,psfmag_u,psfmag_g,psfmag_r,psfmag_i, $ psfmag_z,psfmagerr_u,psfmagerr_g,psfmagerr_r,psfmagerr_i,psfmagerr_z,$ swap=swap ;Reads in returned query info from SDSS ; (see /minock/e/kolinski/CATALOGS/SDSS/query1.fit for example of readable ; file). 030514 DJK ; If keyword swap is set, swaps bytes appropriately for PC fits_open, fname, fcb fits_read, fcb, data, header fits_close, fcb sz = SIZE(data) nstar = sz[2] if(keyword_set(swap)) then begin ddat=data(0:15,*) rdat=data(16:55,*) byteorder,ddat,/l64swap byteorder,rdat,/lswap data(0:15,*)=ddat data(16:55,*)=rdat endif rad = DOUBLE(data[0:7, *], 0, nstar) decd = DOUBLE(data[8:15, *], 0, nstar) psfmag_u = FLOAT(data[16:19, *], 0, nstar) psfmag_g = FLOAT(data[20:23, *], 0, nstar) psfmag_r = FLOAT(data[24:27, *], 0, nstar) psfmag_i = FLOAT(data[28:31, *], 0, nstar) psfmag_z = FLOAT(data[32:35, *], 0, nstar) psfmagerr_u = FLOAT(data[36:39, *], 0, nstar) psfmagerr_g = FLOAT(data[40:43, *], 0, nstar) psfmagerr_r = FLOAT(data[44:47, *], 0, nstar) psfmagerr_i = FLOAT(data[48:51, *], 0, nstar) psfmagerr_z = FLOAT(data[52:55, *], 0, nstar) ;REQUESTED TESTS: s1 = WHERE(psfmag_r GE 14.5 AND psfmag_r LE 16.5 AND psfmagerr_u LE .03 AND $ psfmagerr_g LE .03 AND psfmagerr_r LE .03 AND psfmagerr_i LE .03 AND $ psfmagerr_z LE .03, ns1) s2 = WHERE(psfmag_g[s1]-psfmag_r[s1] LT 0.2, ns2) s3 = WHERE(psfmag_g[s1]-psfmag_r[s1] GT 0.7, ns3) print, 'file: '+fname print, 'stars in file: '+STRTRIM(STRING(nstar),2) print, "stars where (14.5 GE r' LE 16.5): "+STRTRIM(STRING(ns1),2) print, "stars (with above constraint) where (g'-r' LT 0.2): "+ $ STRTRIM(STRING(ns2),2) print, "stars (with above constraint) where (g'-r' GT 0.7): "+ $ STRTRIM(STRING(ns3),2) ;PLOT HISTOGRAM h = HISTOGRAM((psfmag_g[s1]-psfmag_r[s1]), BINSIZ=0.1, MIN=-0.5, MAX=1.5) x=-.5+findgen(21)/10 Set_plot, 'PS' Device, filename=fname+'.ps', /LANDSCAPE PLOT, x, h, title = fname, xtitle="g'-r", xstyle=1 Device, /CLOSE Set_plot, 'X' END