;+ ; NAME: subreg_shiftstopeaks ; PURPOSE: ; Given a shifts array created by subreg, convert this to ; an array of peak pixel locations in an image, as needed ; for input to the mosf function. ; ; INPUTS: ; KEYWORDS: ; OUTPUTS: ; ; HISTORY: ; Began 2003-11-25 17:55:53 by Marshall Perrin ; 2006-08-18 - no recenter! ;- PRO subreg_shiftstopeaks,imgs,shifts,px,py,ref=ref,whichref=whichref if keyword_set(whichref) and ~(keyword_set(ref)) then ref=imgs[*,*,whichref] if not(keyword_set(ref)) then ref=imgs[*,*,0] sz = size(imgs) if sz[0] eq 3 then nimgs=sz[3] else nimgs=1 findmaxstar,ref,xo1,yo1,/silent ; find the rough position of the first star mrecenter,ref,xo1,yo1,xo,yo,/silent ; find precise position of t px=xo-transpose(shifts[0,*]) ; calculate positions of all other stars py=yo-transpose(shifts[1,*]) ; using the shifts relative to the first one ; for i = 0, nimgs-1 do begin ; ; make sure that we're within the right ranges. This is necessary ; ; since the FFT shift finding 'wraps', so it can return a shift of -N/2 ; ; instead of N/2 and so on. ; if px[i] lt 0 then px[i]=px[i]+sz[1] ; if px[i] gt sz[1] then px[i]=px[i]-sz[1] ; if py[i] lt 0 then py[i]=py[i]+sz[2] ; if py[i] gt sz[2] then py[i]=py[i]-sz[2]; ; endfor end