PRO star_measure,arr,stars,peak=peak,r=r,dx=dx,dy=dy,skyrad=skyrad, $ centroid=centroid, nofit=nofit, silent=silent ;+ ; STAR_MEASURE ; ; Measure positions and rough fluxes for a group of stars. Uses ; STAR_CEN. ; ; Calling Sequence ; ; STAR_MEASURE,arr,stars ; ; Arguments ; ; ARR The 2-D data array containing the stars to be measured. ; ; STARS The array of data structures containing the information on ; the stars. ; ; On input, this contains the list of stars to be measured. ; On output, this contains the measured positions and fluxes of ; the stars. ; ; A "stars" array can be generated as follows: ; ; a={star, id:'', ; The label for the star ; x:0.0, y:0.0, ; The x,y position of the star ; xfwhm:0.0, yfwhm:0.0, ; The x,y FWHM of the star ; r:0.0, ; Radius for fitting position ; counts:0.0, ; Counts - sky in the aperture ; sky:0.0, ; Sky level ; sharp:0.0} ; Sharpness (See STAR_CEN) ; stars = replicate({star},n) ; ; Keywords ; ; R If set, forces all measurement apertures to the same value ; ; PEAK If set to a value, search within peak pixels of the ; specfied location for the pixel with the highest value, and ; fit using that as the nominal center position. ; ; DX,DY If set, add these offsets to the position of each star ; before fitting positions. ; ; SKYRAD A 2 element vector giving the inner and outer radius of the ; sky aperture for each star. ; ; CENTROID If set, then measure the centroid of the image using ; CNTRD rather than fitting a gaussian. ; ; NOFIT If set, positions and FWHM values are not fit. The ; photometry and sharpness are measured at the specified ; locations, using the specified apertures. ; ; The NOFIT keyword is useful for measuring positions of ; stars using one set of parameters, then performing ; photometry and measuring sharpness with another. ; ;- if (not keyword_set(peak)) then peak=0 if (not keyword_set(dx)) then dx=0 if (not keyword_set(dy)) then dy=0 n = n_elements(stars) for i=0,n-1 do begin if (not keyword_set(silent)) then print,i if(stars(i).x eq -999. or stars(i).y eq -999) then begin x = -999. & y = -999. endif else begin x=stars(i).x+dx & y=stars(i).y+dy endelse if(keyword_set(r)) then stars(i).r=r rr = stars(i).r sid=stars(i).id if (keyword_set(skyrad)) then begin stars(i) = star_cen(arr,x,y,rr,id=sid,peak=peak, $ skyrad=skyrad,centroid=centroid, nofit=nofit) endif else begin stars(i) = star_cen(arr,x,y,rr,id=sid,peak=peak, $ centroid=centroid, nofit=nofit) endelse endfor end