function bell_window, image, f, fy, radial=radial ; ; NAME : BELL_WINDOW ; PURPOSE : Generate the rectangular or circular bell window ; for a given data ; CALLING SEQUENCE: ; value=bell_window(image, f, fy, radial=radial) ; INPUT ; image : 1 or 2-dimensional array ; OPTIONAL INPUT ; f : x-directional fraction of the window ; to be reduced bellow unity down to zero (default=0.1) ; fy : y-directional fraction (default=f) ; KEYWORD INPUT ; RADIAL if set, then the amount of reduction is given ; as a function of distance from the image center ; REQUIRED SUBROUTINE ; XYINDEX ; HISTORY ; Chae, Jong-Chul : April, 1996 ;- if not keyword_set(f) then f= 0.1 s=size(image) case s(0) of 1 : begin nxx=s(1) x=findgen(nxx) x1 = (( x < (nxx-x) )*!pi/(f*nxx)) < !pi window = 0.5*(1.-cos(x1)) end 2: begin if not keyword_set(fy) then fy=f xyindex, image, x, y nxx=s(1) nyy=s(2) if keyword_set(radial) then begin r = sqrt( float(x-nxx/2)^2+float(y-nyy/2)^2) r1 = nxx/2. x1 = ((r1-r)/(f*r1) < 1. )*!pi window = 0.5*(1.-cos(x1))*(x1 ge 0.) end else begin x1 = (( x < (nxx-x) )*!pi/(f*nxx)) < !pi y1 = (( y < (nyy-y) )*!pi/(fy*nyy)) < !pi window = 0.5*(1.-cos(x1))*0.5*(1.-cos(y1)) endelse end endcase return, window end