pro psf_fft,image,psf,fftp
;+
;			fft_psf
;
; compute fft of a point spread function inserted into an image
; with the same size as an input image
;
; INPUTS:
;	image - image with size of the desired psf fft.
;	psf - point spread function
;
; OUTPUTS:
;	fftp - fft of the psf
; HISTORY:
;	version 1  D. Lindler
;	05-27-05   M. Desnoyer - Centered the psf based on flux
;-
;---------------------------------------------------------------------------
	s = size(psf) & nsp = s(1) & nlp = s(2)
	s = size(image) & ns = s(1) & nl = s(2)

	;; Get the center of the psf based on flux. Rick White's method
	xx = lindgen(nsp, nlp)
	yy = xx/nsp
	xx = xx MOD nsp
	ptot = total(psf)
	xcen = round(total(xx*psf)/ptot)
	ycen = round(total(yy*psf)/ptot)
	
	p = fltarr(ns,nl)
	p(0,0) = psf
	p = shift(p,-xcen,-ycen)
	fftp = fft(p,-1)
	return
	end