SWE L2 - use correct energy ordering for PSD #1639
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Summary
Change the energy ordering in
swe_l2.calculate_phase_space_density
to account for the fact thatswe_l1b_science.populate_full_cycle_data
puts the output data in energy order, not scan order.Since intensities are made from PSD, this fixed the intensities as well.
Overview
We noticed in making fake L2 files from ACE that the calculated PSDs were pretty nonphysical.
calculate_phase_space_density
usesget_particle_energy
to look up energies, which are returned in the "checkerboard" energy sweep order. Butpopulate_full_cycle_data
uses the actual energies to put data into an appropriate energy bin ordered byswe_constants.ESA_VOLTAGE_ROW_INDEX_DICT
This may conflict with #1620. Dupe of #1638 because apparently PR's aren't syncing with force pushes anymore....
Updated Files
populate_full_cycle_data
...to exactly match that, it should probably use values fromswe_constants.ESA_VOLTAGE_ROW_INDEX_DICT
, but that seems pretty fragile to LUT changes. Alternatively, this probably should sort by the known energy sweep pattern and catch any problems after the fact, but we don't have that explicitly stored anywhere.test_swe_l2
(the functional) that the ratio of PSD to count rate is the same where the energy is the same. This is done for one particular time step and CEM where I've verified there are counts in all the angle and energy bins. This test fails with the code ondev
and passes with the change.Testing
See updates to
test_swe_l2.py
above