Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions imap_processing/cdf/config/imap_lo_l1b_variable_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,135 @@ count_per_bin:
LABLAXIS: Sample Count
DEPEND_0: epoch
DEPEND_1: spin_angle

pivot:
CATDESC: Pivot angle derived from housekeeping data
FIELDNAM: Pivot Angle
FORMAT: F8.3
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 180.0
VAR_TYPE: support_data
UNITS: deg
LABLAXIS: Pivot Angle

pivot_de:
CATDESC: Pivot angle derived from direct event data
FIELDNAM: Pivot Angle (DE)
FORMAT: F8.3
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 180.0
VAR_TYPE: support_data
UNITS: deg
LABLAXIS: Pivot Angle DE

gt_start_met:
<<: *default
CATDESC: Good time interval start in Mission Elapsed Time
FIELDNAM: Good Time Start MET
FORMAT: F19.3
FILLVAL: -1.0000000E+31
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: s
LABLAXIS: GT Start

gt_end_met:
<<: *default
CATDESC: Good time interval end in Mission Elapsed Time
FIELDNAM: Good Time End MET
FORMAT: F19.3
FILLVAL: -1.0000000E+31
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: s
LABLAXIS: GT End

h_background_rates:
CATDESC: Hydrogen background rates per ESA level
FIELDNAM: H Background Rates
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: data
UNITS: counts/s
LABLAXIS: H BG Rate

h_background_variance:
CATDESC: Hydrogen background rate variance per ESA level
FIELDNAM: H Background Variance
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: data
UNITS: (counts/s)^2
LABLAXIS: H BG Variance

h_synthetic_floor:
CATDESC: Hydrogen synthetic background floor
FIELDNAM: H Synthetic Floor
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: counts/s
LABLAXIS: H Synthetic Floor

h_proxy_floor:
CATDESC: Hydrogen proxy background floor
FIELDNAM: H Proxy Floor
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: counts/s
LABLAXIS: H Proxy Floor

o_background_rates:
CATDESC: Oxygen background rates per ESA level
FIELDNAM: O Background Rates
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: data
UNITS: counts/s
LABLAXIS: O BG Rate

o_background_variance:
CATDESC: Oxygen background rate variance per ESA level
FIELDNAM: O Background Variance
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: data
UNITS: (counts/s)^2
LABLAXIS: O BG Variance

o_synthetic_floor:
CATDESC: Oxygen synthetic background floor
FIELDNAM: O Synthetic Floor
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: counts/s
LABLAXIS: O Synthetic Floor

o_proxy_floor:
CATDESC: Oxygen proxy background floor
FIELDNAM: O Proxy Floor
FORMAT: F12.6
FILLVAL: -1.0000000E+31
VALIDMIN: 0.0
VALIDMAX: 1.0000000E+31
VAR_TYPE: support_data
UNITS: counts/s
LABLAXIS: O Proxy Floor
59 changes: 59 additions & 0 deletions imap_processing/lo/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Contains constants variables to support IMAP-Lo processing."""

# ------- Constants for L1B processing -------

# Ion species tracked. "H" is mandatory; any others for which we have histrates
# may be added here.
ELEMS = ("H", "O")

# Hours into the day (UTC) for HK data to calculate median for pivot angle estimation.
PIVOT_HK_HOUR_RANGE: tuple[int, int] = (3, 15)

# Per-day overrides for the anti-RAM background rate. Keyed by (year, day-of-year)
BG_RATE_ANTI_RAM_OVERRIDES: dict[tuple[int, int], float] = {
(2026, 62): 0.0014,
(2026, 64): 0.0,
(2026, 65): 0.0,
(2026, 91): 0.03,
}
Comment on lines +12 to +18
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hard coded override days 😬. Two major concerns with this:

  1. This required code updates and build/deploy of the Lo container each time an update to these is desired.
  2. Per the PI, the pipeline should be fully automated with no manual intervention to tweak algorithm parameters.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Let me point @nschwadron to this comment - we could put these in a csv but that won't address your concerns. I'm not sure if these overrides are derivable from someplace..

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One possible approach could be to move these exception values into an ancillary file rather than hard-coding them in the algorithm.


# One histogram accumulation cycle duration [s]
HISTOGRAM_CYCLE_EPOCHS: int = 420

N_CYCLE_SUM: int = 1 # Granularity of goodtime boundaries
N_CYCLE_AVE: int = 7 # Cycles to average over when estimating background rates
N_ESA_LEVELS: int = 7 # Total number of ESA levels
RAM_ESA_LEVELS: tuple[int, ...] = (
6,
7,
) # ESA levels for RAM estimation (1-indexed)

# Histogram angular bins (0-indexed) corresponding to the RAM and anti-RAM look
# directions
RAM_HISTOGRAM_BINS: tuple[slice, ...] = (slice(0, 20), slice(50, 60))
ANTI_RAM_HISTOGRAM_BINS: tuple[slice, ...] = (slice(20, 50),)

# Nominal background rates [counts/s] for each species
BG_RATES = {"H": 0.0014925, "O": 0.000136635}
# When no exposure is available, scale the nominal rate down as a conservative estimate.
BG_RATE_FALLBACK_SCALE: dict[str, float] = {"H": 1.0, "O": 0.3}
# Minimum non-zero background rate floor = nominal / divisor
BG_RATE_FLOOR_DIVISOR: dict[str, float] = {"H": 50.0, "O": 150.0}

# Maximum acceptable background count rates [counts/s]. There are separate thresholds
# for RAM vs. anti-RAM, and for pivot near 90 deg vs. others.
THRESHOLD_BG_RATE_RAM_90: float = 0.014
THRESHOLD_BG_RATE_ANTI_RAM_90: float = 0.007
THRESHOLD_BG_RATE_RAM_NON_90: float = 0.0175
THRESHOLD_BG_RATE_ANTI_RAM_NON_90: float = 0.00875

# Maximum time gap [s] between consecutive histogram epochs before treating them as
# separate intervals.
DELAY_MAX: int = 100
# Pivot angles within this range [degrees] are treated as "near 90".
PIVOT_90_RANGE: tuple[float, float] = 88.0, 92.0
# Fraction of each cycle duration that contributes actual exposure.
EXPOSURE_FACTOR: float = 0.5
# Padding [s] added to begin/end of each goodtime interval to ensure complete
# cycles are covered at interval edges.
GOODTIME_PADDING: float = 2.0
Loading
Loading