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)(888.111 μs (427 allocs: 3.974 MiB, without a warmup), 4.535 s (841 allocs: 31.656 KiB, without a warmup), 4.483 s (52 allocs: 2.391 KiB, 0.11% 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" b207-Apr-26 21:31:58: ELFIN EPD: START LOADING.
07-Apr-26 21:31:58: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
07-Apr-26 21:31:59: 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
07-Apr-26 21:32:00: Download of elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf complete, 9.063 MB in 1.2 sec (7.647 MB/sec) (transfer_normal)
07-Apr-26 21:32:00: Unable to get ydata for variable ela_pef_Tspin
07-Apr-26 21:32:00: 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.
07-Apr-26 21:32:00: 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.
07-Apr-26 21:32:00: ELFIN EPD: LOADING END.
07-Apr-26 21:32:00: ELFIN EPD L2: START PROCESSING.
07-Apr-26 21:32:00: ELFIN EPD L2: START ENERGY SPECTOGRAM.
07-Apr-26 21:32:00: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
07-Apr-26 21:32:00: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
07-Apr-26 21:32:02: ELFIN EPD: START LOADING.
07-Apr-26 21:32:02: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
07-Apr-26 21:32:03: 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
07-Apr-26 21:32:04: Download of elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf complete, 9.063 MB in 1.0 sec (9.079 MB/sec) (transfer_normal)
07-Apr-26 21:32:04: Unable to get ydata for variable ela_pef_Tspin
07-Apr-26 21:32:04: 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.
07-Apr-26 21:32:04: 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.
07-Apr-26 21:32:04: ELFIN EPD: LOADING END.
07-Apr-26 21:32:04: ELFIN EPD L2: START PROCESSING.
07-Apr-26 21:32:04: ELFIN EPD L2: START ENERGY SPECTOGRAM.
07-Apr-26 21:32:04: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
07-Apr-26 21:32:04: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
┌ Info: Julia
└ b1 = 2.242 ms (4639 allocs: 1.955 MiB)
┌ Info: PySPEDAS
└ b2 = 2.480 s (1089 allocs: 44.984 KiB, without a warmup)