XRay |
pro
xray,parms,rowdata,xray_cs=xray_cs,info=infoif arg_present(info) then beginif n_elements(info) eq 0 then beginParms=
Replicate({Name:'unused',Value:0d,Unit:'',Hint:''},19)Parms=
Replicate({Name:'unused',Value:0d,Unit:'',Hint:''},19)Parms[
0].Name='dS' & Parms[0].Value=0.180E+19 & Parms[0].Unit='cm^2' & Parms[0].Hint='Source/pixel Area'Parms[
1].Name='dR' & Parms[1].Value=0.600E+09 & Parms[1].Unit='cm' & Parms[1].Hint='Source/voxel Depth'Parms[
2].Name='T_0' & Parms[2].Value=0.200E+08 & Parms[2].Unit='K' & Parms[2].Hint='Plasma Temperature'Parms[
3].Name='eps' & Parms[3].Value=0.500E-01 & Parms[3].Unit='none' & Parms[3].Hint='Matching parm. for TNT distr-ns'Parms[
4].Name='kappa' & Parms[4].Value=4.00 & Parms[4].Unit='none' & Parms[4].Hint='Index of Kappa-distr-n'Parms[
5].Name='N' & Parms[5].Value=16 & Parms[5].Unit='none' & Parms[5].Hint='Number of integration nodes'Parms[
6].Name='Emin' & Parms[6].Value=0.100 & Parms[6].Unit='MeV' & Parms[6].Hint='Low energy cutoff'Parms[
7].Name='Emax' & Parms[7].Value=10.0 & Parms[7].Unit='MeV' & Parms[7].Hint='High energy cutoff'Parms[
8].Name='E_break' & Parms[8].Value=1.00 & Parms[8].Unit='MeV' & Parms[8].Hint='Break E for DPL'Parms[
9].Name='delta1' & Parms[9].Value=4.00 & Parms[9].Unit='none' & Parms[9].Hint='(LE) Power-Law index'Parms[
10].Name='delta2' & Parms[10].Value=6.00 & Parms[10].Unit='none' & Parms[10].Hint='(HE) Power-Law index for DPL'Parms[
11].Name='n_0' & Parms[11].Value=0.500E+10 & Parms[11].Unit='cm^{-3}' & Parms[11].Hint='Thermal e density'Parms[
12].Name='n_b' & Parms[12].Value=0.300E+08 & Parms[12].Unit='cm^{-3}' & Parms[12].Hint='Nonthermal e density'Parms[
13].Name='B' & Parms[13].Value=200. & Parms[13].Unit='G' & Parms[13].Hint='Magnetic field'Parms[
14].Name='theta' & Parms[14].Value=35.0 & Parms[14].Unit='degrees' & Parms[14].Hint='Viewing angle'Parms[
15].Name='Eph_min' & Parms[15].Value=3 & Parms[15].Unit='keV' & Parms[15].Hint='Starting photon energy'Parms[
16].Name='dEph' & Parms[16].Value=0.02 & Parms[16].Unit='Log(keV)' & Parms[16].Hint='Logarithmic step in photon energy'Parms[
17].Name='Dist_E' & Parms[17].Value=3 & Parms[17].Unit='none' & Parms[17].Hint='Type of distribution over energy'Parms[
18].Name='N_E' & Parms[18].Value=101 & Parms[18].Unit='none' & Parms[18].Hint='Number of energy channels'endif else parms=info.parmsE1=Parms[
15].valuedEph=Parms[
16].valueEph=
10^(Alog10(E1)+findgen(Parms[18].value)*dEph); output photon energy arraylogdE=Parms[
16].valueEE =
10^(Alog10(E1)+findgen(Parms[18].value+round(1./logDe))*logdE)DE =
10^(Alog10(E1)+(findgen(Parms[18].value+round(1./logDe))+1)*logdE)-EEEE=EE +
min(dEph)*0.5;electron energies so that max(ee) =10 x max(eph)info={parms:parms,$
pixdim:[parms[
18].value],$spectrum:{x:{axis:Eph,label:
'Energy',unit:'keV'},$y:{label:
'Flux',unit:'1/(s cm^2 keV)'}}} returnendsz=
size(rowdata,/dim)nrows=sz[
0]rowdata[*]=
0for r=0, nrows-1 do beginrparms=
transpose(parms[r,*,*])point_in=
where(rparms[2,*] gt 0, Nvox);addedif Nvox gt 0 then beginparmin=rparms[*,point_in]
;addedE1=parmin[
15,0]logdE=parmin[
16,0]Eph =
10^(Alog10(E1)+findgen(parmin[18,0])*logdE)DEph=
10^(Alog10(E1)+(findgen(parmin[18,0])+1)*logdE)-eph; output photon energy arrayEE =
10^(Alog10(E1)+findgen(parmin[18,0]+round(1./logDe))*logdE)DE =
10^(Alog10(E1)+(findgen(parmin[18,0]+round(1./logDe))+1)*logdE)-EEEE=EE +
min(dEph)*0.5;electron energies so that max(ee) =10 x max(eph)if n_elements(xray_cs) eq 0 then xray_cross_section, ee, Eph, Xray_CSVe=
sqrt(2.*EE*1.6e-9/9.8d-28)e_dataout=
fltarr(N_elements(ee)); normalisation ;****************************************************************V_vox=parmin[
0,*]*parmin[1,*]; Voxel volume in cm^3Np_vox=parmin[
11,*]; plasma number density in the voxelAU2_4pi=(
4.*!PI*1.496d13^2);4pi*1AU^2norm=V_vox*Np_vox/AU2_4pi
; normalisation factor;main loop over all voxels for i=0,Nvox-1 do begin;**********************************************************; If electron distribution is a power-lawIF (ROUND(Parmin[17,i]) EQ 3 OR ROUND(Parmin[17,i]) EQ 11 ) THEN BEGIN; Electron distribution is a power-lawE_dist =((ee
GE Parmin[6,i]*1000.) AND (ee LT Parmin[7,i]*1000.))*EE ^(-Parmin[9,i])E_dist_norm=
total(E_dist*de)IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm ENDIF ; end of power-law case ;**********************************************************;**********************************************************; Electron distribution is doble power-lawIF (ROUND(Parmin[17,i]) EQ 4 OR ROUND(Parmin[17,i]) EQ 12) THEN BEGINE_dist=((ee
GE Parmin[6,i]*1e3) AND (ee LT Parmin[8,i]*1e3))*(EE/(Parmin[8,i]*1e3))^(-Parmin[9,i])+$((ee
GE Parmin[8,i]*1e3) AND (ee LT Parmin[7,i]*1e3))*(EE/(Parmin[8,i]*1e3))^(-Parmin[10,i])E_dist_norm=
total(E_dist*de)IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/E_dist_normENDIF;**********************************************************;**********************************************************; Electron distribution is thermal/non-thermal over energyIF (ROUND(Parmin[17,i]) EQ 5) THEN BEGINkb=
8.617343e-8 ;(keV K-1)Te=parmin[
2,i]*kbE_cr=Te/parmin[
3,i]; critial energy in keVE_dist_cr=
sqrt(E_cr/(!PI*Te))*exp(-E_cr/Te)dens_e=Parmin[
11, i]*(parmin[2,i] GT 2e5)+0.* (parmin[2,i] LE 2e5); density if ionised Te > 2e5KE_dist =((ee
GE Parmin[6,i]*1000.) AND (ee LT E_cr))*sqrt(EE/(!PI*Te))*exp(-EE/Te)E_dist =((ee
GE E_cr) AND (ee LT Parmin[7,i]*1000.))*E_dist_cr*(EE/E_cr) ^(-Parmin[9,i])E_dist_norm=
total(E_dist*de)IF (E_dist_norm GT 0) THEN e_dataout+=dens_e*ve*E_dist*norm[i]/E_dist_normENDIF;**********************************************************;**********************************************************; Electron distribution is kappa distributionIF (ROUND(Parmin[17,i]) EQ 6) THEN BEGINkb=
8.617343e-8 ;(keV K-1)Te=parmin[
2,i]*kbThet=Te/
511.; critial energy in keVgam=
1.d0+EE/511.dens_e=Parmin[
11, i]*(parmin[2,i] GT 2e5)+0.* (parmin[2,i] LE 2e5); density if ionised Te > 2e5KE_dist =((ee
GE Parmin[6,i]*1000.) AND (ee LT Parmin[7,i]*1000.))*$gam*
sqrt(gam*gam-1.)/(1.+(gam-1.)/(Parmin[4,i]-1.5)/Thet)^(Parmin[4,i]+1)/thet^(1.5)E_dist_norm=
total(E_dist*de)IF (E_dist_norm GT 0) THEN e_dataout+=dens_e*ve*E_dist*norm[i]/E_dist_normENDIF;**********************************************************;**********************************************************; If electron distribution is a power-law in momentum p*cIF (ROUND(Parmin[17,i]) EQ 7 ) THEN BEGIN; Electron distribution is a power-lawpc=
sqrt((ee+511.)^2-511.^2)d_pc=(ee+
511.)*de/pcpc_min=
sqrt((Parmin[6,i]*1000.+511.)^2-511.^2)pc_max=
sqrt((Parmin[7,i]*1000.+511.)^2-511.^2)E_dist =((pc
GE pc_min) AND (pc LT pc_max))*pc^(-Parmin[9,i])E_dist_norm=
total(E_dist*d_pc)IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm ENDIF ; end of power-law case ;**********************************************************; If electron distribution is a power-law in momentum p*cIF (ROUND(Parmin[17,i]) EQ 7 ) THEN BEGIN; Electron distribution is a power-lawpc=
sqrt((ee+511.)^2-511.^2)d_pc=(ee+
511.)*de/pcpc_min=
sqrt((Parmin[6,i]*1000.+511.)^2-511.^2)pc_max=
sqrt((Parmin[7,i]*1000.+511.)^2-511.^2)E_dist =((pc
GE pc_min) AND (pc LT pc_max))*pc^(-Parmin[9,i])E_dist_norm=
total(E_dist*d_pc)IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm ENDIF ; end of power-law case ;**********************************************************;**********************************************************; Electron background distribution is thermal - should be always added; IF (ROUND(Parmin[17,i]) EQ 1) THEN BEGIN; Electron distribution is thermalkb=
8.617343e-8 ;(keV K-1)Te=parmin[
2,i]*kb;local temperature in keVe_dataout+=norm[i]*ve*parmin[
11,i]*sqrt(EE/(!PI*Te))*exp(-EE/Te); electron flux for 3D maxwellian; ENDIF;**********************************************************; background thermal electron distributionENDFOR
;ends FOR loop over voxelsrowdata[r,*]=(xray_cs#(e_dataout*DE))
;turning mean LOS electron flux into photon fluxendend
;ends FOR over row
END