proposal-simulation-tool / hydrocarbon / gaussjes2.pro
gaussjes2.pro
Raw
pro gaussjes

; calculating absorption strength for 6.8 micron features 
; CH2

abs_strength_ch2_68=((1465.*2.)/(3.85*10^21.))/10.^(-18.)   ; see chiar paper 
abs_strength_ch3_68=((1470.*3.)/(3.65*10^21.))/10.^(-18.)   ; see chiar paper

abs_strength_av_68=(abs_strength_ch2_68+abs_strength_ch3_68)/2.

column_density_ch2_68=(1.6)/(abs_strength_ch2_68)
column_density_ch3_68=(1.6)/(abs_strength_ch3_68)

column_density_av_68=(column_density_ch2_68+column_density_ch3_68)/2.


; p0=[3.376,3.420, 3.474, 3.520, 3.289,6.19,6.25,6.80,6.825]
; fwhm=[0.05,0.05,0.05,0.05,0.09,0.06, 0.16,0.12,0.12]
; fwhm_wavnum=[47.2, 42.8,41.0, 40.4, 81.8, 15., 40.,26.,26.]
; ;*deltanu=[]
; ;column_density=[0.27, 0.44, 0.21, 0.19,  1.44, 8.19/2.,8.19/2.,column_density_ch2_68/2.,column_density_ch3_68/2.] ; times 10^18
; column_density=[0.27, 0.44, 0.21, 0.19,  1.44, 8.19/2.,8.19/2.,column_density_ch2_68/] ; times 10^18
; abs_strength=[24.3, 15.2, 23.7, 14.8, 2.58,0.275,0.275,abs_strength_ch2_68,abs_strength_ch3_68]  ; times 10^-18

p0=[3.376,3.420, 3.474, 3.520, 3.289,6.19,6.25,6.85]
fwhm=[0.05,0.05,0.05,0.05,0.09,0.06, 0.16,0.12]
fwhm_wavnum=[47.2, 42.8,41.0, 40.4, 81.8, 15., 40.,26.]
;*deltanu=[]
column_density=[0.27, 0.44, 0.21, 0.19,  1.44, 8.19/2.,8.19/2.,column_density_av_68] ; times 10^18
abs_strength=[24.3, 15.2, 23.7, 14.8, 2.58,0.275,0.275,abs_strength_av_68]  ; times 10^-18


;p=findgen(1001.)*0.001+3.
p=findgen(38000.)*0.001+2.

y=dblarr(n_elements(p0), n_elements(p))
spectrum_3_4_micron=dblarr(n_elements(p0), n_elements(p))
x=dblarr(n_elements(p0), n_elements(p))

sigma=1./2.355*fwhm
sigma1=1./2.355*fwhm_wavnum

for i=0, n_elements(p0)-1 do begin

    y[i,*]=1./(sqrt(2.*!pi)*sigma1[i])*exp(-1./2.*(p-p0[i])^2./(sigma[i]^2.))*abs_strength[i]*column_density[i]
    
    spectrum_3_4_micron[i,*]=1./(sqrt(2.*!pi)*sigma1[i])*exp(-1./2.*(p-p0[i])^2./(sigma[i]^2.))

endfor

ytotal=total(y,1)

; scaling the feature to the diffuse ISM 
Av=18.
max_ytotal=max(ytotal,num)
max_y_scale=Av*0.004 ; from paper Yvonne Pendleton 1994
scaling_factor=max_y_scale/max_ytotal
ytotal_scaled=ytotal*scaling_factor
spectrum_3_4_micron_scaled=spectrum_3_4_micron*scaling_factor

plot, p, -1*ytotal_scaled, xrange=[3.2,7.], /xstyle ; to plot the optical depth 

; retrieve the cross section

hydrogen_col_dens=1.9*10^21.*Av

; carbon_abundance=3.9e-4
; carbon_gas_ab=1.5e-4
; carbon_dust_ab=carbon_abundance-carbon_gas_ab
carbon_dust_ab=1.61e-4

carbon_dust_col=carbon_dust_ab*hydrogen_col_dens

; calculate the fractions that go into the different --- it's about 56% of the total carbon abundance 
; what are the fractions of each of the species?

; CH3_asym=column_density[0]*1./4.*1e18/carbon_dust_col
; CH2_asym=column_density[1]*1./3.*1e18/carbon_dust_col
; CH3_sym=column_density[2]*1./4.*1e18/carbon_dust_col
; CH2_sym=column_density[3]*1./3.*1e18/carbon_dust_col
; CH=column_density[4]*1./2.*1e18/carbon_dust_col
; CC1=column_density[5]*1./2.*1e18/carbon_dust_col
; CC2=column_density[6]*1./2.*1e18/carbon_dust_col
; CH2_68=column_density[7]*1./3.*1e18/carbon_dust_col
; CH3_68=column_density[8]*1./4.*1e18/carbon_dust_col

CH3_asym=column_density[0]*1e18/carbon_dust_col
CH2_asym=column_density[1]*1e18/carbon_dust_col
CH3_sym=column_density[2]*1e18/carbon_dust_col
CH2_sym=column_density[3]*1e18/carbon_dust_col
CH=column_density[4]*1e18/carbon_dust_col
CC1=column_density[5]*1e18/carbon_dust_col
CC2=column_density[6]*1e18/carbon_dust_col
CH2_68=column_density[7]*1e18/carbon_dust_col
; CH3_68=column_density[8]*1e18/carbon_dust_col

; fractions=[CH3_asym,CH2_asym,CH3_sym,CH2_sym,CH,CC1,CC2,CH2_68,CH3_68]
 fractions=[CH3_asym,CH2_asym,CH3_sym,CH2_sym,CH,CC1,CC2,CH2_68]



; fname='~/jwst_proposal/gitbranch/JWST_dust_proposal/hydrocarbon/fractions_chx.txt'
; OPENW,1,fname
; for i=0, n_elements(fractions)-1 do begin
; PRINTF, fractions[i], FORMAT='(F7.2)'
; endfor
; CLOSE,1

;writecol, '~/jwst_proposal/gitbranch/JWST_dust_proposal/hydrocarbon/spectrum_34_micron.txt', p, spectrum_3_4_micron_total
writecol, '~/jwst_proposal/gitbranch/JWST_dust_proposal/hydrocarbon/fractions_chx2.txt', fractions, abs_strength

writefits, 'spectrum_34_micron2.fits', spectrum_3_4_micron_scaled




stop 

end