;+ ; PROJECT: ; HESSI ; NAME: ; HSI_GAUSS2 ; ; PURPOSE: ; This function describes a two-dimensional Gaussian distribution. ; ; CATEGORY: ; HESSI, UTIL ; ; CALLING SEQUENCE: ; z = hsi_gauss2( XY, A) ; ; CALLS: ; none ; ; INPUTS: ; XY = values of independent variables along X and Yaxis. Entered as 2x Num_points array. ; A = parameters of equation described below. ; OUTPUTS; ; Z = value returned at each XYi. ; ; Function is: ; Z(x,y) = A0*EXP(-U/2) ; where: U= (yp/A1)^2 + (xp/A2)^2 ; ; If A has 7 elements a rotation of the ellipse is present and: ; xp = (x-A3) * cos(A5) - (y-A4) * sin(A5) ; yp = (x-A3) * sin(A5) + (y-A4) * cos(A5) ; If A has 5 elements, A5 (theta) is 0, the major and minor axes ; of the ellipse are parallel to the XY axes, and: ; xp = (x-A3) and yp = (x-A4) ; ; ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons; ; ; OPTIONAL OUTPUTS: ; none ; ; KEYWORDS: ; none ; COMMON BLOCKS: ; none ; ; SIDE EFFECTS: ; none ; ; RESTRICTIONS: ; Abs argument of exponential held to 50.0 ; ; PROCEDURE: ; none ; ; MODIFICATION HISTORY: ; Version 1, richard.schwartz@gsfc.nasa.gov ; Adapted from IDL library procedure gauss2_funct inside gauss2dfit. ; ;- function hsi_gauss2, xy, a tilt = n_elements(a) eq 6 ;TRUE if angle present. if tilt then begin ;Rotate? xp = xy[0,*] - a[3] ;Expand X values yp = xy[1,*] - a[4] ;expand Y values s = sin(A[5]) & c = cos(A[5]) t = xp * (c/a[1]) - yp * (s/a[1]) yp = xp * (s/a[2]) + yp * (c/a[2]) xp = temporary(t) endif else begin xp = (xy[0,*]-a[3])/a[1] yp = (xy[1,*]-a[4])/a[2] ;expand Y values endelse u = exp(-(0.5 * (xp^2 + yp^2)<50.0)) ;Exp() term, Make it 1D F = a[0] * u return, f end