SPEDAS training session- advanced course -T. Hori, S. Kurita, C.-W. Jun, M. Shoji, and Y. Miyoshi(ERG Science Center, ISEE, Nagoya Univ.)

1

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Goal of this training} We are going to learn how to load, plot, andmanipulate LEP-e data of the ERG satellite, with a
special focus on analysis of observed electron
distribution functions.

} For this purpose, we try to reproduce various plots

published in Kazama et al., GRL, 2018.

2SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Contents of today's course} Read/plot Lv.3 prov. data
} Quick review of how to use part_products withLEP-e data} HFA specs and PA-limited E-t specs of LEP-e (likeFigure 1 of Kazama et al. [2018])} PA-energy spectra and their line plot (like Figures 2and 3)} Density and temperature by part_products andMaxwellian-fitting (like Figure 4)

3

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Keep in mind upon the training} This is a "hands-on" training for SPEDAS, not a time fore-mail check!

} Communicate with lecturers, tutors, and neighboringskilled users.

} Today's session might not be able to cover all topics in

the handouts due to time limitation. It is
recommended to go through the entire contents laterby yourself.

} We will proceed rather slowly with intermediate-level

users, but you can practice at your own pace.

4

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Keep in mind upon the training (cont'd)} The band width of the available wireless networks

is quite limited today. For a smooth and successful
training, please be sure to follow the rules listed
below, when you are hooked up to the WiFi
networks for the training:
Stop using/synchronizing online storages (Dropbox,Google drive, OneDrive, iCloud, etc.) to save the band
width of the network.
} Turn off Windows Update temporarily (Windows users).
} Do not access online movie sites (Youtube, Niko-NikoDouga(ニコニコ動画), etc.).
}}
5SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Before starting:
Preparation of data files} We have asked you to download necessary datafiles in advance, BEFORE you come here.

} The data files should be saved under the data root

directory returned by the function root_data_dir().
}

6Type print, root_data_dir() on IDL then yourdata root directory will be shown.

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Before starting:
Choice of the color table} In this handouts, all figures are drawn with thecolor table "JET".
} But, of course, you can do this training with yourown favorite color scheme.
JET

FAST-special(default)

viridisloadct2 accepctstable numbers of 0–74.
IDL> loadct_sd, 467loadct2, 43

loadct_sd, 47

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Brief introduction on a newly arrived
data set: LEP-e Level-3 provisinal data

8SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Provisional Lv.3 data of LEP-e
ERG> timespan,'2017-05-01'

ERG> erg_load_lepe_pa, uname=uname, pass=pass
ERG> tplot, 'erg_lepe_l3_prov_PA_' + ['energy_15', 'pitchangle_09' ]Please type the command lines without the command prompt "ERG>".
The prompt is omitted from the next slide on so that one can justcopy&paste commands on an IDL console.

9SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Quick review of the usages of thepart_products library

10

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

What's "part_products"?
} A set of generic routines bundled to SPEDAS to

make tplot variables for various types of spectrum
plot.

3-D flux
data
Typically a 4-D array(time x energy x azim x elev)

11

part_products
library2-Dspectrum
data• time x energy• time x pitch angle• …
• …

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Basic usage of part_products:
Energy spectra of average flux
timespan, '2017-04-12'
erg_load_lepe, datatype='3dflux', uname=uname, pass=pass, /no_sort_enebin
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy'
tplot, 'erg_lepe_l2_3dflux_FEDU_energy'

12SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Basic usage of part_products:
Pitch angle spectratimespan, '2017-04-12/04:00',8, /hour & get_timespan, tr
erg_load_mgf & set_erg_var_label
magvn = 'erg_mgf_l2_mag_8sec_dsi' & posvn = 'erg_orb_l2_pos_gse'
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='pa', $energy=[1000., 1500.], trange=tr, mag=magvn, pos=posvn
tplot, 'erg_lepe_l2_3dflux_FEDU_*'

13SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Basic usage of part_products:
Energy spectra for a limited PA range
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy', $trange=tr, mag=magvn, pos=posvn, pitch=[80, 100]
tplot, 'erg_lepe_l2_3dflux_FEDU_*'

14

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Basic usage of part_products:
Velocity moments
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', $output='moments', mag=magvn,pos=posvn, trange=tr
tplot, 'erg_lepe_l2_3dflux_FEDU_' + $['energy','pa','ptens', 'density']

15

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Reproduction of the figures ofKazama et al. [GRL, 2018]16

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 1 of Kazama+2018
timespan, '2017-04-12/16:00', 2, /hour
get_timespan, tr
erg_load_lepe, datatype='3dflux', uname=uname, pass=pass, /no_sort_enebin
erg_load_mgf
set_erg_var_label
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy'
erg_load_pwe_hfa, datatype='spec'
erg_load_pwe_ofa, datatype='spec'
options, 'erg_pwe_hfa_l2_lm_spectra_e_mix', zrange=[1e-8, 1e-2], zlog=1, ytitle='PWE/HFA!C(E_MIX)', $ysubtitle='[Hz]', auto_downsample=1
options, 'erg_pwe_ofa_spec_l2_E_spectra_merged', zrange=[1e-8, 1e-2], zlog=1, ytitle='PWE/OFA!Cspec', $ysubtitel='[Hz]', auto_downsample=1
tplot, ['erg_pwe_hfa_l2_lm_spectra_e_mix', 'erg_pwe_ofa_spec_l2_E_spectra_merged', 'erg_lepe_l2_3dflux_FEDU_energy' ]17SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 1 of Kazama+2018 (cont'd)erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy', $trange=tr, mag=magvn, pos=posvn, pitch=[0, 15], suffix='_pa00-15'
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy', $trange=tr, mag=magvn, pos=posvn, pitch=[85, 95], suffix='_pa85-95'
zlim, ['erg_lepe_l2_3dflux_FEDU_energy_pa*'], 1e+2, 1e+6, 1tplot, [ 'erg_pwe_hfa_l2_lm_spectra_e_mix', $'erg_pwe_ofa_spec_l2_E_spectra_merged', $'erg_lepe_l2_3dflux_FEDU_energy_pa*' ]18

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 2 of Kazama+2018
dists = erg_lepe_get_dist( 'erg_lepe_l2_3dflux_FEDU', trange=tr )erg_part_en_pa_spec_plot, dists[450], units='flux'
erg_part_en_pa_spec_plot, dists, time='2017-04-12/17:00:00', units='eflux'
erg_part_en_pa_spec_plot, dists, $time=['2017-04-12/17:05:35','2017-04-12/17:06:08'], $/with_contour, units='df_km'

19

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 2 of Kazama+2018 (cont'd)erg_part_en_pa_spec_plot, dists, $time=['2017-04-12/17:05:35','2017-04-12/17:06:08'], $/noplot, rslt=rslt, units='df_km'
help, rslt
yid = nn2( rslt.y_pitchangle, 30. ) ;; for PA=30 deg
plot, rslt.x_energy, rslt.z_hist[*, yid], /xlog, /ylog, psym=-6
yid2 = nn2( rslt.y_pitchangle, 90 ) ;; for PA=90 deg
oplot, rslt.x_energy, rslt.z_hist[*, yid2], psym=-6,
color=spd_get_color('purple')

20

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 2 of Kazama+2018 (cont'd)erg_part_maxwellian_fit, rslt.x_energy[2:14], rslt.z_hist[2:14, yid2], n90, kbt90
df_km = erg_part_get_maxwellian( rslt.x_energy, n90, kbt90 )oplot, rslt.x_energy, df_km, color=spd_get_color('purple'), $linestyle=2, thick=2.5
print, 'n = ', n90, ' [/cc]', 'kBT = ', kbt90,' [eV]'

erg_part_maxwellian_fit, rslt.x_energy[2:14], rslt.z_hist[2:14, yid], n30, kbt30
df_km = erg_part_get_maxwellian( rslt.x_energy, n30, kbt30 )oplot, rslt.x_energy, df_km, color=spd_get_color('black'), $linestyle=2, thick=2.5
print, 'n = ', n30, ' [/cc]', '21

kBT = ', kbt30,' [eV]'

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 3 of Kazama+2018
timespan, '2017-04-12/16:50', 40, /min & get_timespan, tr
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='pa', units='df_km', $energy=[90., 92.], suffix='_91ev', trange=tr, mag=magvn, pos=posvn
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='pa', units='df_km', $energy=[341., 343.], suffix='_342ev', trange=tr, mag=magvn, pos=posvn
erg_load_pwe_efd, datatype='pot'
tplot, [22'erg_pwe_efd_l2_Vave', 'erg_lepe_l2_3dflux_FEDU_pa_342ev', $'erg_lepe_l2_3dflux_FEDU_pa_91ev' ]SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 3 of Kazama+2018 (cont'd)erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy', units='eflux', $pitch=[85., 95.], suffix='_pa85-95', trange=tr, mag=magvn, pos=posvn
erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='energy', units='eflux', $pitch=[0., 15.], suffix='_pa00-15', trange=tr, mag=magvn, pos=posvn
get_data,'erg_lepe_l2_3dflux_FEDU_energy_pa85-95', data=dperp, dl=dl, lim=lim

get_data,'erg_lepe_l2_3dflux_FEDU_energy_pa00-15', data=dpara, dl=dl, lim=lim

id_342ev = nn( dperp.v[0, *], 342. )id_91ev = nn( dperp.v[0, *], 91 )store_data, 'erg_lepe_eflux_342ev', data={x:dperp.x, y:[ [dperp.y[*, id_342ev]], [dpara.y[*, id_342ev]] ] }store_data, 'erg_lepe_eflux_91ev', data={x:dperp.x, y:[ [dperp.y[*, id_91ev]], [dpara.y[*, id_91ev]] ] }ylim, 'erg_lepe_eflux_*ev', 0, 0, 0
options, 'erg_lepe_eflux_*ev', labels=['perp', 'para'], colors=[2, 187], ysubtitle=dl.ztitle
tplot, ['erg_pwe_efd_l2_Vave', 'erg_lepe_eflux_342ev', 'erg_lepe_l2_3dflux_FEDU_pa_342ev', 'erg_lepe_eflux_91ev', 'erg_lepe_l2_3dflux_FEDU_pa_91ev' ]23

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Figure 4 of Kazama+2018
erg_load_pwe_hfa, level='l3'
ylim, 'erg_pwe_hfa_l2_lm_spectra_e_mix', 10., 100., 1zlim, 'erg_pwe_hfa_l2_lm_spectra_e_mix', 1e-9, 1e-2, 1
calc, '"erg_pwe_efd_ne_vsc" = 26.39 * exp( -0.6546 * "erg_pwe_efd_l2_Vave" )'erg_lep_part_products, 'erg_lepe_l2_3dflux_FEDU', output='moments', energy=[40., 750.], mag=magvn, pos=posvn, trange=tr
ylim, 'erg_lepe_l2_3dflux_FEDU_magt3', 1e+1, 1e+3, 1
store_data, 'erg_lepe_efd_density', data=['erg_pwe_efd_ne_vsc', 'erg_lepe_l2_3dflux_FEDU_density' ]
ylim, 'erg_lepe_efd_density', 1e-2, 1e+2, 1
options, 'erg_lepe_efd_density', ytitle='Density', ysubtitle='[/cc]', colors=[2, 6], $labels=['total', 'hot'], labflag=-1, constant=[0.1, 1., 10.]
tplot, [ 'erg_pwe_hfa_l3_ne_mgf', 'erg_pwe_hfa_l2_lm_spectra_e_mix', 'erg_lepe_efd_density', 'erg_lepe_l2_3dflux_FEDU_magt3' ]24SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Comparison of fitted parameters and integratedparameters[Kazama+2018]

by part_products

The hot density andtemperatures were derived
with the bi-Maxwellian fitting.

25

The same parameters havebeen derived by justintegrating 3-D distributionfunctions.

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Exercise

26

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

If you have completed too early, please fill theremaining time by trying the following exercise.
}Do Maxwellian fitting for LEP-e data for the entire time interval of
16:50–17:30 to derive and then plot time series of the fitted
number density and perpendicular temperature.
}}}

Please fit to distribution functions in the energy range of 67–1000 eV.
You only have to calculate only perpendicular density and temperature.
You could combine the following commands:}27

erg_lep_part_products, get_data, erg_part_maxwellian_fit,
store_data, tplot, …

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Appendix

28

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Appendix A-1:
List of velocity moments by part_products
del_data, '*'(copied from the handouts of the training session of last year)

timespan, '2017-03-27/10:00', 1, /hour& get_timespan, tr

erg_load_mepe, datatype='3dflux', varformat='FEDU'
erg_load_mepi_nml, datatype='3dflux', varformat='FPDU'
erg_load_mgf & erg_load_orb

erg_mep_part_products, 'erg_mepi_l2_3dflux_FPDU', pos='erg_orb_l2_pos_gse',
mag='erg_mgf_l2_mag_8sec_dsi', output='moments', trange=tr
erg_mep_part_products, 'erg_mepe_l2_3dflux_FEDU', pos='erg_orb_l2_pos_gse',
mag='erg_mgf_l2_mag_8sec_dsi', output='moments', trange=tr
Primary parameters calculated with the part_products:}

density: number density}

avgtemp: scalar temperature (!)}

velocity: bulk velocity}}

vthermal: thermal velocity
mtens: momentum flux density tensor}

ptens: pressure tensor}

t3: temperature tensor (!)}

magt3: perpendicular/parallel temperature (!)}

flux: number flux
eflux: energy flux}

All vector and tensor quantities in DSI coordinates.
(!) Note that these are NOT a temperature defined
as a width of Maxwellian distribution.

29

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Appendix A-2:
3-D data structure common to particle data that SPEDAS can handle
ERG> help, dists[0]** Structure <18a6808>, 21 tags, length=196736, data length=196725, refs=2:
PROJECT_NAMESTRINGSPACECRAFT

LONG

'ERG'
1

DATA_NAMESTRING'LEP-e Electron 3dflux'

UNITS_NAMESTRING'flux'An example for LEP-e 3-D flux data:

UNITS_PROCEDURE STRING'erg_convert_flux_units'

SPECIESSTRING

'e'

VALID

BYTE

CHARGE

FLOAT-1.00000

MASS

FLOAT

5.68566e-06

TIME

DOUBLE

1.4920128e+09

END_TIMEDOUBLE

1.4920128e+09

DATA

FLOAT

Array[32, 16, 12]

BINS

FLOAT

Array[32, 16, 12]

ENERGYFLOATArray[32, 16, 12]

DENERGYFLOAT

Array[32, 16, 12]

NENERGY

LONG

32

NBINS

LONG

192

PHI

FLOAT

Array[32, 16, 12]

DPHI

FLOAT

Array[32, 16, 12]

THETA

FLOAT

Array[32, 16, 12]

DTHETAFLOAT

Array[32, 16, 12]

ERG>

30

1

dist is an array of structures eachof which contains a set of data foreach spin.

"DATA" holds the flux data as a 3-D array of 32 ene.
ch x 16 spin sector x 12 sensors for this case.
ENERGY and DENERGY are the central energies
and energy ranges of the energy channels.
PHI, DPHI, THETA, and DTHETA have phi/theta
angles of particle-going directions and angularwidths measured by directional channels of aparticle instrument in the DSI coordinate system.

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Appendix A-3:
Some other options available for erg_part_en_pa_spec_plot
erg_part_en_pa_spec_plot, dist $, time=time $; a time or time range for plotting, units=units $; physical unit 'flux','eflux','df_km','df_cm', with_contour=with_contour $; to overlay contour lines, zrange=zrange $; explicitly set the range for the color scale, npabin=npabin $; number of pitch angle bins (default: 19), rslt=rslt $; to obtain data arrays which have been plotted, noplot=noplot; set to suppress replottingYou can use this for other particle data.
For example:
timespan, '2017-04-12/16:00', 2, /hour
get_timespan, tr
erg_load_mepe, datatype='3dflux'
dists = erg_mepe_get_dist( $'erg_mepe_l2_3dflux_FEDU', trange=tr)
erg_part_en_pa_spec_plot, dists

31

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019

Appendix A-4:
ISEE3D: a 3-D distribution function viewer
Now ISEE3D
supports LEP-e
data!
Detailed functions of thetool were described byKeika et al. [EPS, 2018].

ERG> erg_crib_lepe_isee3d, $trange='2017-04-12/'+['16:00','17:30']

32

SPEDAS training (Adv. course) @Univ. of Tokyo

Sep. 19, 2019