Validation and Benchmark with PySPEDAS
We compare ELFINData results against PySPEDAS to ensure numerical parity and to track performance. The following benchmarks illustrate the typical workflow.
State variable ELA_POS_GEI: Julia is about 200 times faster than Python for this retrieval.
using PySPEDAS
using ELFINData
using Chairmarks
trange = ("2021-08-08", "2021-08-10")
ela_pos_gei = ELA_POS_GEI(trange)
py_ela_pos_gei = Array(PySPEDAS.elfin.state(trange).ela_pos_gei)
@assert ela_pos_gei == py_ela_pos_gei'
@b Array(ELA_POS_GEI(trange)), PySPEDAS.elfin.state(trange), pyspedas.projects.elfin.state(trange)(771.701 μs (430 allocs: 3.974 MiB, without a warmup), 2.765 s (841 allocs: 31.656 KiB, without a warmup), 2.952 s (52 allocs: 2.391 KiB, 0.17% compile time, without a warmup))Processing EPD L2 spectra: Julia is about 100 times faster than Python for spectral derivations across the same interval.
trange = ("2020-10-01", "2020-10-02")
nflux_para = epd_spectral(trange).para
py_nflux_para = PySPEDAS.elfin.epd(trange; level = "l2").ela_pef_hs_nflux_para
@assert nflux_para ≈ Array(py_nflux_para)'
b1 = @b epd_spectral($trange)
b2 = @b PySPEDAS.elfin.epd($trange; level = "l2")
@info "Julia" b1
@info "PySPEDAS" b225-Apr-26 01:56:06: ELFIN EPD: START LOADING.
25-Apr-26 01:56:06: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
25-Apr-26 01:56:07: Downloading https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf to elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf
25-Apr-26 01:56:08: Download of elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf complete, 9.063 MB in 0.2 sec (47.344 MB/sec) (transfer_normal)
25-Apr-26 01:56:08: Unable to get ydata for variable ela_pef_Tspin
25-Apr-26 01:56:08: Variable ela_pef_hs_epa_spec DEPEND_1 attribute ela_pef_energies_mean has length 16, but corresponding data dimension has length 10. Removing attribute.
25-Apr-26 01:56:08: Variable ela_pef_fs_epa_spec DEPEND_1 attribute ela_pef_energies_mean has length 16, but corresponding data dimension has length 18. Removing attribute.
25-Apr-26 01:56:08: ELFIN EPD: LOADING END.
25-Apr-26 01:56:08: ELFIN EPD L2: START PROCESSING.
25-Apr-26 01:56:08: ELFIN EPD L2: START ENERGY SPECTOGRAM.
25-Apr-26 01:56:08: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
25-Apr-26 01:56:08: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
25-Apr-26 01:56:09: ELFIN EPD: START LOADING.
25-Apr-26 01:56:09: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
25-Apr-26 01:56:11: Downloading https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf to elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf
25-Apr-26 01:56:11: Download of elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf complete, 9.063 MB in 0.2 sec (47.933 MB/sec) (transfer_normal)
25-Apr-26 01:56:11: Unable to get ydata for variable ela_pef_Tspin
25-Apr-26 01:56:11: Variable ela_pef_hs_epa_spec DEPEND_1 attribute ela_pef_energies_mean has length 16, but corresponding data dimension has length 10. Removing attribute.
25-Apr-26 01:56:11: Variable ela_pef_fs_epa_spec DEPEND_1 attribute ela_pef_energies_mean has length 16, but corresponding data dimension has length 18. Removing attribute.
25-Apr-26 01:56:11: ELFIN EPD: LOADING END.
25-Apr-26 01:56:11: ELFIN EPD L2: START PROCESSING.
25-Apr-26 01:56:11: ELFIN EPD L2: START ENERGY SPECTOGRAM.
25-Apr-26 01:56:11: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
25-Apr-26 01:56:11: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
┌ Info: Julia
└ b1 = 2.387 ms (5832 allocs: 1.993 MiB)
┌ Info: PySPEDAS
└ b2 = 1.626 s (1089 allocs: 44.984 KiB, without a warmup)