function rmbaddat,ra,dec,mag,err,x,chip,xcen,ycen,sky,sharp,chi,cam,$ nbch,nbp,nbst ; This routine removes from the data vectors any stars having values of sharp ; or chi outside of specified ranges, as well as all stars from chips having ; bad coord spreads, indicating a failure of the conversion to world ; coordinates. ; The routine also returns nbch = number of chips with bad coord spread, ; nbp = number of stars w/ bad chi/sharp, after ; bad chips have been removed. ; and nbst = number of stars with bad sharp or chi val, ; or on bad chips. ; constants wmnd=[0.,.1,.32,.10] wmnr=[0.,.1,.07,.10] wmxd=[0.,.25,.44,.25] wmxr=[0.,.25,.14,.25] ;.21 for index 2? widmind=wmnd(cam) widminr=wmnr(cam) widmaxd=wmxd(cam) widmaxr=wmxr(cam) ;widmin=.10 ;widmax=.25 rad2deg=57.295 shmax=1. chimax=8. ; temporary to get more bright stars until ; Mark tweaks psffit parmeter in DAOPHOT temprarmin = 0 temprarmax = 5 tempdecmin = 0 tempdecmax = 5 nst0=n_elements(ra) lgood=[-1] nbch=4 for i=0,3 do begin sw=where(chip eq i+1,nsw) if(nsw gt 0) then begin rar=max(ra(sw))-min(ra(sw)) decr=max(dec(sw))-min(dec(sw)) decc=(max(dec(sw))+min(dec(sw)))/2. rar=15.*rar*cos(decc/rad2deg) if(rar ge widminr and rar le widmaxr and decr ge widmind and $ decr le widmaxd) then begin lgood=[lgood,sw] nbch=nbch-1 endif endif endfor if(max(lgood) ge 0) then begin sw=where(lgood ge 0,nsw) lgood=lgood(sw) ra=ra(lgood) dec=dec(lgood) mag=mag(lgood) err=err(lgood) x=x(lgood) chip=chip(lgood) xcen=xcen(lgood) ycen=ycen(lgood) sky=sky(lgood) sharp=sharp(lgood) chi=chi(lgood) endif else begin print,'No good coords in this image!' nbst=0 nbp=0 return,-1 endelse s=where(abs(sharp) lt shmax and chi lt chimax,ns) nbst=nst0-ns nbp=n_elements(ra)-ns if(ns gt 0) then begin ra=ra(s) dec=dec(s) mag=mag(s) err=err(s) x=x(s) chip=chip(s) xcen=xcen(s) ycen=ycen(s) sky=sky(s) sharp=sharp(s) chi=chi(s) return,0 endif else begin print,'No good data in this image!' return,-1 endelse end