Viewing contents of file '../idllib/ssw/allpro/atmos.pro'
;+
; Project     : SDAC
;                   
; Name        : ATMOS
;               
; Purpose     : This function returns the X-ray cross-sections for the Earth's
;	atmosphere in units of cm2/gm
;               
; Category    : XRAY, UTIL
;               
; Explanation : Using the accepted concentrations of Nitrogen, Oxygen, and Argon
;	together with the cross-sections available through xsec.pro, the cross-section
;	is computed vs energy from 1.00001 to 999.999 keV.
;               
; Use         :  cross_section = Atmos( Energy )
;    
; Inputs      :  Energy - scalar or vector in units of keV. 1.00001 to 999.999 keV.
;               
; Opt. Inputs : Numberfrac - Array of three numbers totaling 1 for the relative
;	percent compositon by weight of N, O, and Ar.
;               
; Outputs     : Returns the cross-section in units of cm2/gm.
;
; Opt. Outputs: None
;               
; Keywords    : Type - A string with values 'PE'-photoelectric, 'SI'-Compton scattering,
;		'SC'- elastic scattering.  See xsec.pro for more details.
;
; Calls       : XSEC, CHECKVAR, COEFDATA
;
; Common      : None
;               
; Restrictions: 
;               
; Side effects: None.
;               
; Prev. Hist  : Written, RAS, ~1988
;
; Modified    : Version 2, Revised for SSW, RAS, richard.schwartz@gsfc.nasa.gov, 20-jul-1997.
;
;-            
;
;
function atmos,e,numberfrac, type=type  ; total xsection in units of cm^2/gm

checkvar, type, 'ab'
checkvar,numberfrac,[.755,.231,.0129] ; percent composition by weight
;[nitrogen,oxygen,argon]
coefdata, coef
z=[7,8,18] ;atomic numbers
mu=e*0
for i=0,2 do begin & wn=where(z(i) eq coef.z) 
 mu=mu+xsec(e,z(i),type)*numberfrac(i)/(coef(wn(0)).conv*coef(wn(0)).at_den)
endfor

return,mu 
end