pro gaussjes
p0=[6.85]
fwhm=[ 0.12]
fwhm_wavnum=[26.]
;*deltanu=[]
column_density=[8.19] ; times 10^18
abs_strength=[0.275] ; times 10^-18
;p=findgen(1001.)*0.001+3.
p=findgen(38000.)*0.001+2.
y=dblarr(n_elements(p0), n_elements(p))
spectrum_6_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_6_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= 0.42425709
;max_y_scale/max_ytotal
ytotal_scaled=ytotal*scaling_factor
spectrum_6_micron_scaled=spectrum_6_micron*scaling_factor
plot, p, -1*ytotal_scaled, xrange=[6.0,7.0], /xstyle ; to plot the optical depth
; retrieve the cross section
hydrogen_col_dens=1.9*10^21.*Av
carbon_abundance=3e-4
carbon_gas_ab=1.5e-4
carbon_dust_ab=carbon_abundance-carbon_gas_ab
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?
CC1=column_density[0]*1e18/carbon_dust_col
fractions=[CC1]
; 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_chx.txt', fractions, abs_strength
;writefits, 'spectrum_34_micron.fits', spectrum_6_micron_scaled
stop
end