pro sxt_bcs,bcsi,bcsd,sxt
;+
; NAME
;  sxt_bcs.pro   
;
; PURPOSE
;  To use the result of fit_bsc from analysis of BCS Sulphur spectra to 
;  obtain a corresponding intensity expected to be observed through the 
;  x-ray analysis filters.
;
; CALLING SEQUENCE
;  sxt_bcs,bcsi,bcsd,sxt2,sxt3
;
; INPUT
;  bcsi : The index obtained from fit_bsc
;  bcsd : The data obtained from fit_bsc
;
; OUTPUT
;  sxt2 : The intensity expected to be observed through filter 2, Al
;  sxt3 : The intensity expected to be observed through filter 3, AlMg
;
; OPTIONAL OUTPUT
;
;
; OPTIONAL KEYWORD INPUT
;  none yet	
;
; RESTRICTION
;  Assumes isothermal plasma source.
;
; HISTORY
;  Written CAF 12 Nov 95 : caf@mssl.ucl.ac.uk
;          caf 4-May-97 : Fixed a couple of bugs, and incorparated a couple 
                          of improvements. Now returns intensities for all 
			  SXT filters. 


temp=alog10(bcsi.fit.te6*1e6)
emission=alog10(bcsi.fit.em50)+50.
window,1,xsiz=512,ysiz=512,title='Log(Emission Measure)'
plot,smooth(emission,2),ys=1
window,2,xsiz=512,ysiz=512,title='Log(Temperature)'
plot,smooth(temp,2),ys=1
window,3,xsiz=512,ysiz=512,title='Mewe Spectrum'
tet=5.5+findgen(51)*0.05
dn1=sxt_flux(tet,1)
dn2=sxt_flux(tet,2)
dn3=sxt_flux(tet,3)
dn4=sxt_flux(tet,4)
dn5=sxt_flux(tet,5)
dn6=sxt_flux(tet,6)
plot_io,tet,dn2,yr=[0.01,1000]
oplot,tet,dn3,linestyle=3
factor1=dspline(tet,dn1,temp)
factor2=dspline(tet,dn2,temp)
factor3=dspline(tet,dn3,temp)
factor4=dspline(tet,dn4,temp)
factor5=dspline(tet,dn5,temp)
factor6=dspline(tet,dn6,temp)
window,4,xsiz=512,ysiz=512,title='Predicted SXT Counts'
utplot,bcsi,factor2*(10d^(emission-44.)),xs=1
outplot,bcsi,factor3*(10d^(emission-44.)),linestyle=3
outplot,bcsi,factor4*(10d^(emission-44.)),linestyle=4
outplot,bcsi,factor5*(10d^(emission-44.)),linestyle=5
outplot,bcsi,factor6*(10d^(emission-44.)),linestyle=6
sxt=dindgen(n_elements(factor2),6+1.)
sxt(*,1)=factor1*(10d^(emission-44.))
sxt(*,2)=factor2*(10d^(emission-44.))
sxt(*,3)=factor3*(10d^(emission-44.))
sxt(*,4)=factor4*(10d^(emission-44.))
sxt(*,5)=factor5*(10d^(emission-44.))
sxt(*,6)=factor6*(10d^(emission-44.))
end
