;+ ;FUNCTION: n_3d_new(dat,ENERGY=en,ERANGE=er,EBINS=ebins,ANGLE=an,ARANGE=ar,BINS=bins) ;INPUT: ; dat: structure, 2d data structure filled by get_eesa_surv, get_eesa_burst, etc. ;KEYWORDS ; ENERGY: fltarr(2), optional, min,max energy range for integration ; ERANGE: fltarr(2), optional, min,max energy bin numbers for integration ; EBINS: bytarr(na), optional, energy bins array for integration ; 0,1=exclude,include, ; na = dat.nenergy ; ANGLE: fltarr(2,2), optional, angle range for integration ; theta min,max (0,0),(1,0) -900. ; energy/charge analyzer ; the following 2 lines were added to prevent photoelectron contamination when in the plasmasheet ind=where(energy lt denergy,count) if count gt 0 and charge lt 0 then energy(ind)=0. ;solid_angle_corr=4.*!pi/total(domega(0,*)) ; this should be correct in the structure ;if (solid_angle_corr lt .99 or solid_angle_corr gt 1.01) and max(theta) gt 1.2 then print,'Error in dat.domega' ;solid_angle_corr=1. ;density = solid_angle_corr*Const*total(denergy*(energy^(.5))*data*domega) ;density = Const*total(denergy*(energy^(.5))*data*domega) density = Const*total(denergy*(energy^(.5))*data*2.*cos(theta)*sin(dtheta/2.)*dphi) ;for i=0,na-1 do begin ; print,Const*total(denergy(i,*)*(energy(i,*)^(.5))*data(i,*)*2.*cos(theta(i,*))*sin(dtheta(i,*)/2.)*dphi(i,*)),energy(i,0),denergy(i,0),dat2.sc_pot ;endfor ; print,Const*total(denergy(1,*)*(energy(1,*)^(.5))*data(1,*)*2.*cos(theta(1,*))*sin(dtheta(1,*)/2.)*dphi(1,*)),energy(1,0),denergy(1,0),dat2.sc_pot ; units are 1/cm^3 return, density end