; con_width_funct_2.pro Corrects SUMER Line Widths ; Klaus Wilhelm 03 September 1997 ; Instrumental widths based on P. Lemaire's calculations. ; See con_width_2.pro for details. ; Diffraction orders treated according to selected order 04 November 1997 ; Con_width_funct_2.pro replaces con_width_funct_test.pro 27 November 1997 ; Emphasized operation of keyword /FWHM #### 11 September 2000 ; fwhm_out renamed within procedure $$$$ 30 May 2001 ; Values outside limits now returned as -1 (was 0) 03 July 2006 ;------------------------------------------------------------------------------- ; What to do? ; Before you can apply this function, you have to run the procedure ; con_width_2 (see con_width_2.pro), in order to produce look-up tables. ; They are included in the EOF software tree and thus con_width_2.pro is not ; required when working in this environment. This function is a modification ; of con_width_funct_test (treatment of second order explicitly introduced ; and renamed after test phase). ; Apply function: ; IDL> width=con_width_funct_2(slit,wavelength,order,fwhm_out[,/keyword(s)]) ; Gives Doppler or FWHM width (without spectrometer line width and slit effect) ; for FWHM output. Wavelength and FWHM_out can be corresponding vectors. ; Order has to be a scalar (only first or second order lines can be ; treated at a time). ;------------------------------------------------------------------------------- function con_width_funct_2,slit,wavelength,order,fwhm_out,FWHM=FWHM,DETB=DETB ; Input: #### ; slit number : 1, 2, 3, 4, 5, 6, 7 or 8 ; wavelength in Å ; fwhm_out: Detector output (input to function; use FWHM, even if you #### ; are working on the default setting!!) in mÅ #### ; Order (scalar) ; Doppler width (Default) : Delta lambda Doppler in mÅ ; FWHM (keyword /FWHM) : FWHM in mÅ ; Controls only the output of the function, but not the input, which is #### ; FWHM in any case! #### ; Detector A (Default) ; Detector B (keyword /DETB) dir=getenv('CONVOLUTION') case 1 of (slit ge 3) and (slit le 5): slit=4 (slit ge 6): slit=7 else: slit=slit endcase width=0.0 if keyword_set(DETB) then begin limit_2=750.0; Angstroem limit_1=661.0 endif else begin limit_2=805.0 limit_1=780.0 endelse wavelength=wavelength*order ; Transposes all wavelengths into 1st order fwhm_out_m=fwhm_out*order; $$$$ if (min(wavelength) lt limit_1) or (max(wavelength) gt 2*limit_2) then message,$ 'Wavelengths must be between '$ +strtrim(limit_1/order,2)+' and '+strtrim(2*limit_2/order,2)+' Å' if keyword_set(DETB) then begin w_680=where(wavelength le 880,cnt1) w_1080=where(wavelength gt 880 and wavelength le 1284,cnt2) w_1488=where(wavelength gt 1284,cnt3) if cnt1 gt 0 then begin wave=680 fwhm_out_680=fwhm_out_m(w_680); $$$$ restore,$ concat_dir(dir,'con_'+strtrim(fix(slit),2)+'det_b'+strtrim(wave,2)+'.rst') if keyword_set(FWHM) then width_in=fwhm_in else width_in=d_lam_d_in result_680=fwhm_out_680*0.0 width_680=fwhm_out_680*0.0 InRange = where((fwhm_out_680 ge min(fwhm_out_c)) and $ (fwhm_out_680 le max(fwhm_out_c)), cIn) OutRange =where((fwhm_out_680 lt min(fwhm_out_c)) or $ ( fwhm_out_680 gt max(fwhm_out_c)), cOut) if cIn eq 0 then message,'FWHM must be between '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ' If cOut gt 0 then message,/info,$ 'Some of the widths entered are outside the limits '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ. '+$ 'These values will be returned as -1.' result_680(InRange) = interpol(width_in,fwhm_out_c,fwhm_out_680(InRange)) if cOut ne 0 then result_680(OutRange) = -1 NonZero = where(result_680 ne 0,cNZ) if cNZ gt 0 then width_680(NonZero)=result_680(NonZero) $ else print,$ 'You are outside the available FWHM range.' width=[width,width_680] endif if cnt2 gt 0 then begin wave=1080 fwhm_out_1080=fwhm_out_m(w_1080); $$$$ restore,$ concat_dir(dir,'con_'+strtrim(fix(slit),2)+'det_b'+strtrim(wave,2)+'.rst') if keyword_set(FWHM) then width_in=fwhm_in else width_in=d_lam_d_in result_1080=fwhm_out_1080*0.0 width_1080=fwhm_out_1080*0.0 InRange = where((fwhm_out_1080 ge min(fwhm_out_c)) and $ (fwhm_out_1080 le max(fwhm_out_c)), cIn) OutRange =where((fwhm_out_1080 lt min(fwhm_out_c)) or $ ( fwhm_out_1080 gt max(fwhm_out_c)), cOut) if cIn eq 0 then message,'FWHM must be between '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ' If cOut gt 0 then message,/info,$ 'Some of the widths entered are outside the limits '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ. '+$ 'These values will be returned as -1.' result_1080(InRange) = interpol(width_in,fwhm_out_c,fwhm_out_1080(InRange)) if cOut ne 0 then result_1080(OutRange) = -1 NonZero = where(result_1080 ne 0,cNZ) if cNZ gt 0 then width_1080(NonZero)=result_1080(NonZero) $ else print,$ 'You are outside the available FWHM range.' width=[width,width_1080] endif if cnt3 gt 0 then begin wave=1488 fwhm_out_1488=fwhm_out_m(w_1488); $$$$ restore,$ concat_dir(dir,'con_'+strtrim(fix(slit),2)+'det_b'+strtrim(wave,2)+'.rst') if keyword_set(FWHM) then width_in=fwhm_in else width_in=d_lam_d_in result_1488=fwhm_out_1488*0.0 width_1488=fwhm_out_1488*0.0 InRange = where((fwhm_out_1488 ge min(fwhm_out_c)) and $ (fwhm_out_1488 le max(fwhm_out_c)), cIn) OutRange =where((fwhm_out_1488 lt min(fwhm_out_c)) or $ ( fwhm_out_1488 gt max(fwhm_out_c)), cOut) if cIn eq 0 then message,'FWHM must be between '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ' If cOut gt 0 then message,/info,$ 'Some of the widths entered are outside the limits '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ. '+$ 'These values will be returned as -1.' result_1488(InRange) = interpol(width_in,fwhm_out_c,fwhm_out_1488(InRange)) if cOut ne 0 then result_1488(OutRange) = -1 NonZero = where(result_1488 ne 0,cNZ) if cNZ gt 0 then width_1488(NonZero)=result_1488(NonZero) $ else print,$ 'You are outside the available FWHM range.' width=[width,width_1488] endif endif else begin wave=1200 restore,$ concat_dir(dir,'con_'+strtrim(fix(slit),2)+'det_a'+strtrim(wave,2)+'.rst') if keyword_set(FWHM) then width_in=fwhm_in else width_in=d_lam_d_in result_1200=fwhm_out_m*0.0; $$$$ width_1200=fwhm_out_m*0.0; $$$$ InRange = where((fwhm_out_m ge min(fwhm_out_c)) and $; $$$$ (fwhm_out_m le max(fwhm_out_c)), cIn); $$$$ OutRange =where((fwhm_out_m lt min(fwhm_out_c)) or $; $$$$ ( fwhm_out_m gt max(fwhm_out_c)), cOut); $$$$ if cIn eq 0 then message,'FWHM must be between '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ' if cOut gt 0 then message,/info,$ 'Some of the widths entered are outside the limits '+$ strtrim(min(fwhm_out_c)/order,2)+' and '$ +strtrim(max(fwhm_out_c)/order,2) +' mÅ. '+$ 'These values will be returned as -1.' result_1200(InRange)=interpol(width_in,fwhm_out_c,fwhm_out_m(InRange)); if cOut ne 0 then result_1200(OutRange) = -1 NonZero = where(result_1200 ne 0,cNZ) if cNZ gt 0 then width_1200(NonZero)=result_1200(NonZero) $ else print, 'You are outside the available FWHM range.' width=[width,width_1200] endelse return,width(1:*)/order end