;+ ; ; NAME : GAUSS_PROFILE ; ; PURPOSE : Calcultes Gaussian profiles ; ; CALLING SEQUENCE : ; ; Value = GAUSS_PROFILE(W, gauss_par) ; ; INPUTS: ; W values at which the function is evaluated ; ; GAUSS_PAR Normal Gaussian parameters ; which define a Gaussian profile in the way : ; ; continuum = GAUSS_PAR(0,*,*) in counts ; peak = GAUSS_PAR(1,*,*) in counts ; center = GAUSS_PAR(2,*,*) in pixels ; width = GAUSS_PAR(2,*,*) in pixels ; ; I(W) = continuum+peak*exp(-0.5*((W-center)/width)^2) ; RESTRICTION: ; GAUSS_PAR should not be a scalar. ; The first dimension should be 4. ; ; If GAUSS_PAR is an 1-d array, then W can be any of ; scalar, 1-d array, 2-d array etc. ; IF GAU_PAR is a 2-d or 3-d array, then W should ; be either a scalar or 1-d array. ; ; OUTPUTS: ; Value spectral profiles ; (1-d, 2-d or 3-d array) ; with N0 x N1 X N2 elements ; N0 = number of X(*,0,0) elements ; N1 x N2 = number of GAUSS_PAR(0,*,*) elements ; ; ; MODIFICATION HISTORY ; ; April 1997 Jongchul Chae ;- function GAUSS_PROFILE,W, gauss_par sw=size(w) nw =n_elements(w) sp=size(gauss_par) if sp(0) lt 1 then goto, error1 if n_elements(gauss_par(*,0,0)) ne 5 then goto, error1 if nw eq 0 then goto, error cutoff=20. peak = GAUSS_PAR(1,*,*) center = GAUSS_PAR(2,*,*) width = GAUSS_PAR(3,*,*) case sp(0) of 1 : begin continuum=gauss_par(0) center=center(0) width=width(0) peak=peak(0) continuum=continuum + gauss_par(4)*(w-center)/width value = continuum+ $ peak*exp(-(0.5*((W-center)/width)^2