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 = getdata(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(getdata(ELA_POS_GEI, trange)), PySPEDAS.elfin.state(trange), pyspedas.projects.elfin.state(trange)(1.599 ms (668 allocs: 3.454 MiB, without a warmup), 2.554 s (909 allocs: 38.594 KiB, without a warmup), 2.362 s (48 allocs: 2.125 KiB, 0.19% 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" b224-Nov-26 00:34:32: ELFIN EPD: START LOADING.
24-Nov-26 00:34:32: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
24-Nov-26 00:34:33: 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
24-Nov-26 00:34:33: Download of elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf complete, 9.063 MB in 0.2 sec (41.895 MB/sec) (transfer_normal)
24-Nov-26 00:34:33: 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.
24-Nov-26 00:34:33: 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.
24-Nov-26 00:34:34: ELFIN EPD: LOADING END.
24-Nov-26 00:34:34: ELFIN EPD L2: START PROCESSING.
24-Nov-26 00:34:34: ELFIN EPD L2: START ENERGY SPECTOGRAM.
24-Nov-26 00:34:34: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
24-Nov-26 00:34:34: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
24-Nov-26 00:34:35: ELFIN EPD: START LOADING.
24-Nov-26 00:34:35: Downloading remote index: https://data.elfin.ucla.edu/ela/l2/epd/fast/electron/2020/
24-Nov-26 00:34:37: File is current: elfin_data/ela/l2/epd/fast/electron/2020/ela_l2_epdef_20201001_v01.cdf
24-Nov-26 00:34:37: 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.
24-Nov-26 00:34:37: 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.
24-Nov-26 00:34:37: ELFIN EPD: LOADING END.
24-Nov-26 00:34:37: ELFIN EPD L2: START PROCESSING.
24-Nov-26 00:34:37: ELFIN EPD L2: START ENERGY SPECTOGRAM.
24-Nov-26 00:34:37: ELFIN EPD L2: START PITCH ANGLE SPECTOGRAM.
24-Nov-26 00:34:37: Energy channel [(0, 2), (3, 5), (6, 8), (9, 15)] are used for epd l2 pitch angle spectra.
┌ Info: Julia
└ b1 = 1.101 ms (955 allocs: 1.759 MiB)
┌ Info: PySPEDAS
└ b2 = 1.430 s (1688 allocs: 70.359 KiB, without a warmup)