;+ ; ; NAME : LINE_PAR_CONV ; ; PURPOSE : Convert normal Gaussian parameters into physical ; line parameters or vice versa. ; ; CALIING SEQUENCE : ; Value = LINE_PAR_CONV(data, wl, dispersion $ ; [, rest_pixel], reverse=reverse) ; ; ; INPUTS: ; DATA line fitting parameters ; (1-d, 2-d, or 3-d floating array) ; which define a Guassian profile in the way : ; ; continuum = DATA(0,*,*) in counts ; peak = DATA(1,*,*) in counts ; center = DATA(2,*,*) in pixels ; width = DATA(2,*,*) in pixels ; ; I(j) = continuum+peak*exp(-0.5*((j-center)/width)^2) ; ; WL rest wavelength of the line given in angstroms ; ; DISPERSION dispersion given in angstrom/pixel ; ; OPTIONAL INPUTS: ; ; REST_PIXEL the pixel value corresponding to WL ; if not specified, it is set to zero. ; ; OUTPUTS: ; VALUE physical line parameters ; (1-d, 2d-, or 3-d floating array) ; ; VALUE(0,*,*) : continuum in counts ; VALUE(1,*,*) : integrated intensity in counts ; VALUE(2,*,*) : Doppler Shift in km/s defined by ; ; shift = (center-median(center) ; -rest_pixelmedian(rest_pixel))*dispersion/wl*c ; so that the median value of Doppler shift should be ; very close to zero. ; ; ; VALUE(3,*,*) : Doppler Width in km/s defined by ; ; Doppler Width = 1.414*width*dispersion/wl*c ; ; KEYWORDS : ; ; REVERSE If set, given input are interpreted to be ; physical line parameters and line fitting ; parameters are returned. ; ; ; MODIFICATION HISTORY ; ; April 1997 Jongchul Chae ;- function line_par_conv, data, wl, dispersion, rest_pixel, $ reverse=reverse c=3.0e5 factor = dispersion/wl*c nstep = n_elements(data(0,0,*)) ny=n_elements(data(0,*,0)) if n_elements(rest_pixel) eq 0 then rest_pixel1=0. else $ if n_elements(rest_pixel) eq 1 then $ rest_pixel1=replicate(rest_pixel, ny,nstep) else $ if n_elements(rest_pixel) ne nstep then begin tmp=widget_message( $ ['# of elements in the variable REST_PIXEL should be ' , $ 'the same as # of elements of the third dimension of DATA', $ 'in the routine LINE_PAR_CONV'], /error) return, -1 endif else rest_pixel1=replicate(1, ny)#rest_pixel if not keyword_set(reverse) then begin value = float(data) ; Contiuum Level value(0,*,*) = float(data(0,*,*)) ;Integrated Intensity in counts value(1,*,*) = float(data(1,*,*))*float(data(3, *,*))*sqrt(2*!pi) ;Doppler Shift in km/s ; ( by assuming that the pixel position of a line is measured from ; the position corresponding to the rest wavelength of the line ) value(2, *, *) = (data(2,*,*) -rest_pixel1)*factor ;Doppler Width in km/s value(3, *,*) =1.414*data(3,*,*)*factor endif if keyword_set(reverse) then begin value = round(data) value(2, *) = round((data(2, *,*)/factor+rest_pixel) ) value(3, *) = round(data(3, *,*)/factor/1.414) value(1, *) = round(data(1, *,*)/sqrt(2.*!pi) /value(3, *)) endif return,reform(value) end