timespan,'8 6 15/08:00',4,/hours
trange=['8 6 15/08:00','8 6 15/12:00']
sc='d'
thm_load_state,probe=sc,/get_supp
thm_load_fit,probe=sc,data='fgs',coord='gsm',suff='_gsm'
thm_load_fit,probe=sc,data='fgs',coord='dsl',suff='_dsl'
thm_load_mom,probe=sc
thm_load_esa,probe=sc
ylim,'thd_pe??_en_eflux',5,30000,1
thm_load_esa_pkt,probe=sc
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_moments_old, probe = sc, instrum = 'peir', scpot_suffix = '_pxxm_pot', $
trange=trange,erange=[0,31],mag_suffix = '_fgs_dsl', tplotnames = tn, $
verbose = 2
calc," 'thd_peir_en_eflux_before'='thd_peir_en_eflux' "
thm_part_moments_old, probe = sc, instrum = 'peir', scpot_suffix = '_pxxm_pot', $
trange=trange,erange=[0,31],mag_suffix = '_fgs_dsl', tplotnames = tn, $
verbose = 2, /bgnd_remove
calc," 'thd_peir_en_eflux_after'='thd_peir_en_eflux' "
tplot,'thd_peir_en_eflux_before thd_peir_en_eflux_after'
stop
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_moments_old, probe = sc, instrum = 'peif', scpot_suffix = '_pxxm_pot', $
trange=trange,erange=[0,31],mag_suffix = '_fgs_dsl', tplotnames = tn, $
verbose = 2
calc," 'thd_peif_en_eflux_before'='thd_peif_en_eflux' "
thm_part_moments_old, probe = sc, instrum = 'peif', scpot_suffix = '_pxxm_pot', $
trange=trange,erange=[0,31],mag_suffix = '_fgs_dsl', tplotnames = tn, $
verbose = 2, /bgnd_remove
calc," 'thd_peif_en_eflux_after'='thd_peif_en_eflux' "
tplot,'thd_peif_en_eflux_before thd_peif_en_eflux_after'
stop
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_getspec_old,probe=sc, trange=trange, theta=[-90,90], phi=[0,360], $
data_type=['peif'], /energy, tplotsuffix='_after2',/bgnd_remove
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_getspec_old,probe=sc, trange=trange, theta=[-90,90], phi=[0,360], $
data_type=['peif'], /energy, tplotsuffix='_after2',/bgnd_remove
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_getspec_old,probe=sc, trange=trange, theta=[-90,90], phi=[0,360], $
data_type=['peir'], /energy, tplotsuffix='_after2',/bgnd_remove
trange=['8 6 15/08:00','8 6 15/12:00']
thm_part_getspec_old,probe=sc, trange=trange, theta=[-90,90], phi=[0,360], $
data_type=['peer'], /energy, tplotsuffix='_after2',/bgnd_remove
zlim,'thd_peif_en_eflux*',1.e5,1.e7,1
ylim,'thd_peif_en_eflux*',5.,30000.,1
tplot,'thd_peif_en_eflux_before thd_peif_en_eflux_after thd_peif_en_eflux_after2'
tplot,'thd_peir_en_eflux_before thd_peir_en_eflux_after thd_peir_en_eflux_after2'
tlimit,trange
stop
thm_part_getspec_old,probe=sc, trange=trange, theta=[-45,45], phi=[0,360], $
data_type=['peif'], start_angle=0, angle='phi', $
tplotsuffix='_eq2', erange=[5000.,15000.], /bgnd_remove
zlim,'thd_peif_an_eflux_phi_eq2',1.e5,1.e7,1
thm_part_getspec_old,probe=sc, trange=trange, $
data_type=['peif'], angle='pa', $
tplotsuffix='_eq2', erange=[5000.,15000.], /bgnd_rem
thm_part_getspec_old,probe=sc, trange=trange, $
data_type=['peif'], angle='pa', $
tplotsuffix='_eq_norm2', erange=[5000.,15000.],/norm, /bgnd_rem
thm_part_getspec_old,probe=sc, trange=trange, theta=[-45,45], phi=[0,360], $
data_type=['peef'], start_angle=0, angle='phi', $
tplotsuffix='_eq2', erange=[2000.,8000.], /bgnd_rem
thm_part_getspec_old,probe=sc, trange=trange, $
data_type=['peef'], angle='pa', $
tplotsuffix='_eq2', erange=[2000.,8000.], /bgnd_rem
thm_part_getspec_old,probe=sc, trange=trange, $
data_type=['peef'], angle='pa', $
tplotsuffix='_eq_norm2', erange=[2000.,8000.],/norm, /bgnd_rem
tplot,'thd_fgs_gsm thd_peir_en_eflux_after2 thd_peif_an_eflux_phi_eq2 ' + $
'thd_peif_an_eflux_pa_eq2 thd_peif_an_eflux_pa_eq_norm2 thd_peer_en_eflux_after2 ' + $
'thd_peef_an_eflux_phi_eq2 thd_peef_an_eflux_phi_eq_norm2'
tlimit,trange
stop
thm_part_moments_old, probe = sc, instrum = 'peir', scpot_suffix = '_pxxm_pot', $
trange=trange,erange=[0,31],mag_suffix = '_fgs_dsl', tplotsuffix='_after3', $
/bgnd_remove,bgnd_npoints=1,bgnd_scale=1.02,bgnd_type='angle'
tplot,'thd_peir_en_eflux_*'
end