Skip to content

2594 lo l2 updates to cg code and bg variable names#2596

Merged
subagonsouth merged 5 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2594-lo-l2---updates-to-cg-code-and-bg-variable-names
Jan 21, 2026
Merged

2594 lo l2 updates to cg code and bg variable names#2596
subagonsouth merged 5 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2594-lo-l2---updates-to-cg-code-and-bg-variable-names

Conversation

@subagonsouth
Copy link
Contributor

Change Summary

Overview

Updates included:

  • Going through the CG code with Nathan, he wanted the equations I used to exactly match his Mapping document even though I was doing thing right just without a few negative signs.
  • Update to the bg_rate and associated uncertainty variables in order to get them to output to the CDF.

Closes: #2594

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the Compton-Getting (CG) transformation equations to match Nathan's mapping document and renames background rate variables from plural to singular form for consistency.

Changes:

  • Updated CG correction equations with sign changes to match the mapping document exactly
  • Renamed background rate variables from bg_rates to bg_rate and similar plural-to-singular changes for related uncertainty variables
  • Updated CDF configuration files to reflect new variable names
  • Added test to verify new background rate variables are present in L2 output

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
imap_processing/ena_maps/utils/corrections.py Updated CG transformation equations with sign corrections and comment clarifications
imap_processing/lo/l2/lo_l2.py Renamed bg_rates variables to bg_rate (singular) throughout the processing pipeline
imap_processing/cdf/config/imap_enamaps_l2-rectangular_variable_attrs.yaml Added configuration for bg_rate_stat_uncert and bg_rate_sys_err variables
imap_processing/cdf/config/imap_enamaps_l2-healpix_variable_attrs.yaml Added configuration for bg_rate_stat_uncert and bg_rate_sys_err variables
imap_processing/cdf/config/imap_enamaps_l2-common_variable_attrs.yaml Updated variable names and descriptions from bg_rate_uncert to bg_rate_stat_uncert and added bg_rate_sys_err
imap_processing/tests/lo/test_lo_l2.py Added test to verify bg_rate variables are present in integration test output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +615 to +616
# x_k = (-êₛ · û_sc) + sqrt(y² + (êₛ · û_sc)² - 1)
# dot_product = look_hat dot usc_hat = (-êₛ · û_sc)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states that "dot_product = look_hat dot usc_hat = (-êₛ · û_sc)" implying the dot product equals the negative of the look direction dot spacecraft direction. However, the actual calculation at lines 581-588 computes a positive dot product between pset["look_direction"] and sc_direction_vector without any negation. Either the comment or the code needs to be corrected for consistency.

Suggested change
# x_k = (-êₛ · û_sc) + sqrt(y² + (êₛ · û_sc)² - 1)
# dot_product = look_hat dot usc_hat = (-êₛ · û_sc)
# x_k = (êₛ · û_sc) + sqrt(y² + (êₛ · û_sc)² - 1)
# dot_product = look_hat · û_sc = (êₛ · û_sc)

Copilot uses AI. Check for mistakes.
velocity_sc = x * sc_velocity_km_per_sec

# Calculate the kinetic energy in the spacecraft frame
# Calculate the kinetic energy of the spacecraft
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Calculate the kinetic energy of the spacecraft" but this should be "Calculate the kinetic energy of the ENA in the spacecraft frame" to accurately reflect what is being calculated. The variable name "energy_sc" correctly indicates it's the ENA energy in spacecraft frame, not the spacecraft's own kinetic energy.

Suggested change
# Calculate the kinetic energy of the spacecraft
# Calculate the kinetic energy of the ENA in the spacecraft frame

Copilot uses AI. Check for mistakes.
subagonsouth and others added 2 commits January 21, 2026 13:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@subagonsouth subagonsouth merged commit 54a6895 into IMAP-Science-Operations-Center:dev Jan 21, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this to Done in IMAP Jan 21, 2026
@subagonsouth subagonsouth deleted the 2594-lo-l2---updates-to-cg-code-and-bg-variable-names branch January 21, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Lo L2 - Updates to CG code and bg variable names

3 participants