function hsi_convl,A,P,REAL=real ;+ ; NAME: hsi_convl ; ; PURPOSE: ; IDL routine to convolve array A with a point spread function P ; ; CALLING SEQUENCE: C=hsi_convl(A,P [,/REAL]) ; ; INPUTS: ; A = map vector or array (REAL OR COMPLEX) ; P = PSF vector or array, same size as A ; ; OPTIONAL INPUT: ; If REAL is set, then only the real part is returned ; ; OUTPUT: ; Convolved matrix or vector, shifted to make the origin the same ; as A. If P is 1 at array center, C=A ; ; RESTRICTIONS: ; A and P must be vectors or matrices of the same size, dimension LE 2 ; ; NOTES: ; The astron program "convolve" does not allow input arrays of ; equal size, so this program is complementary to it. ; With this function, ; total(C)=total(A)*total(P) ; hsi_convl(A,P)=hsi_convl(P,A) ; hsi_convl(A,P1+P2)=hsi_convl(A,P1)+hsi_convl(A,P2) ; ; VERSION HISTORY: ; VERS. 2.0 OCTOBER 25, 1999, EJS ; ;- sz_a=size(a) & sz_p=size(p) if (sz_a(0) NE sz_p(0)) then message,"Input arrays don't have same dimensions" if (sz_a(0) eq 1) then $ if (sz_a(1) NE sz_p(1)) then message,'Input vectors have different sizes' if (sz_a(0) eq 2) then begin if ( (sz_a(1) NE sz_p(1)) OR (sz_a(2) NE sz_p(2)) ) then $ message,'Input arrays have different sizes' n1=sz_a(1) & n2=sz_a(2) endif if (sz_a(0) gt 2) then message,'Arrays of dimension 3 or higher not supported' c=fft(fft(a,1)*fft(p,1),-1) if keyword_set(real) then c=float(c) if sz_a(0) eq 1 then c=shift(c,sz_a(1)/2) $ else c=shift(c,sz_a(1)/2,sz_a(2)/2) return,c end