pro rd_obsdiag,jd1,jd2,jdo,obsname,filter,exptime,noin,no2m,bads,good,ref,targ,$ new,diags,zdb=zdb ; This routine opens the file $ZDBASE/obs2db.log and searches it for ; entries occurring between the input jd1 and jd2. It returns a bunch ; of diagnostic values as arrays, for easy plotting. Returned data are: ; jdo = JD associated with observation ; obsname = name of processed data file (string) ; filter = filter name (string) ; exptime = exposure time ; noin = number of input stars ; no2m = number of 2MASS stars ; bads(3,*) = no of bad chips, no of stars w/ bad chi or sharp values, total ; bad stars discarded for any reason ; good = number of good 4-shooter stars retained ; ref = number of ref stars found ; targ = number of target stars found ; new = number of new stars found ; diags(ndiag,*) = vector of diagnostic outputs from obsdiagnos.pro ; If keyword zdb is set, it overrides the environment variable ZDBASE zdbase=getenv('ZDBASE') if(keyword_set(zdb)) then zdbase=zdb path=zdbase+'/survey/' openr,iun,path+'obs2db.log',/get_lun ; count good entries ss='' nobs=0 while(not eof(iun)) do begin readf,iun,ss readf,iun,ss words=get_words(ss) jdot=double(words(1)) jdoti=long(jdot) if(jdot ge jd1 and jdot le jd2) then nobs=nobs+1 for j=0,7 do begin readf,iun,ss endfor endwhile ; initialize arrays jdo=dblarr(nobs) obsname=strarr(nobs) filter=strarr(nobs) exptime=fltarr(nobs) noin=lonarr(nobs) no2m=lonarr(nobs) bads=lonarr(3,nobs) good=lonarr(nobs) ref=lonarr(nobs) targ=lonarr(nobs) new=lonarr(nobs) diags=fltarr(8,nobs) ; load up the data point_lun,iun,0 nn=0 while(not eof(iun)) do begin readf,iun,ss words=get_words(ss) readf,iun,ss words1=get_words(ss) jdot=double(words1(1)) jdoti=long(jdot) if(jdot ge jd1 and jdot le jd2) then begin obsname(nn)=words(1) filter(nn)=words(4) jdo(nn)=jdot exptime(nn)=float(words(7)) readf,iun,ss words=get_words(ss,nc) noin(nn)=long(words(6)) no2m(nn)=long(words(7)) readf,iun,ss words=get_words(ss,nc) bads(0,nn)=long(words(6)) bads(1,nn)=long(words(7)) bads(2,nn)=long(words(8)) readf,iun,ss words=get_words(ss,nc) good(nn)=long(words(3)) readf,iun,ss ;stop words=get_words(ss,nc) ref(nn)=long(words(5)) targ(nn)=long(words(6)) new(nn)=long(words(7)) ;stop readf,iun,ss words=get_words(ss,nc) ndiag=fix(words(3)) ver=fix(words(4)) if(ndiag ne 8 or ver gt 2) then goto, bailout dd=fltarr(8) readf,iun,dd diags(*,nn)=dd readf,iun,ss nn=nn+1 endif else begin for j=0,7 do begin readf,iun,ss endfor endelse endwhile close,iun free_lun,iun goto,fini bailout: print,'bad version or ndiag count!' fini: end