gsmooth
f1
BoaF1.f90
! NAM: gsmooth (subroutine)
! HIS: FB040514 created
! DES: Smooth an image with a Gaussian kernel
! f(x) = exp( -4 ln2 [x/FWHM]^2 ) where 4*ln2 = 2.772588
! f(FWHM/2) = 0.5, f(FWHM) = 0.0625, f(1.5*FWHM)=0.002
! that extends to a*FWHM, where a=1.5 (may be changed).
! The kernel is in fact a square box.
! For FWHM=1, it is of size 5x5, for 2 its 7x7, for 3 11x11 etc.
! The computation of the kernel values is approximate, simply
! taking f(x) at the pixel center.
! Blanked image pixels are ignored in the averaging.
! Current blanking value = -1.e-7
! Blanks will be unblanked if they have nonblanked pixels in the
! kernel range, else they stay at the blank value. Note that blanks
! are not considered to have zero value!
! INP:
! image : input rank-2 array('f') with bounds (ii,jj); ii>1,jj>1
! fwhm : input float. FWHM of Gaussian in pixel.
! OUT:
! image : rank-2 array('f') with bounds (ii,jj).
!
! USE: image = f90.f1.gsmooth(image,fwhm)
! EXAMPLE:
! from Numeric import *
! import f90,time
! im = zeros(21,21,'f') +5.
! im[11,11] = 10. # make a peak in the center
! im[11,10] = -1.e-7 # set to blanking value
! t0 = time.clock()
! im = f90.f1.gsmooth(im,3.)
! print str(time.clock()-t0)
!
! for a 1001^2 array with FWHM=3 (kernel size=11x11) it takes 3.2 sec
! =5 17x17 5.6