Processing for a lo/l1b/goodtimes product#3117
Processing for a lo/l1b/goodtimes product#3117tmplummer merged 8 commits intoIMAP-Science-Operations-Center:devfrom
Conversation
af822aa to
378b5bd
Compare
tmplummer
left a comment
There was a problem hiding this comment.
Just one major concern with this implementation. I left some other relevant comments too.
| start_et_hk = ( | ||
| hk_epoch_ets[0] + timedelta(hours=PIVOT_HK_HOUR_RANGE[0]).total_seconds() | ||
| ) | ||
| end_et_hk = ( | ||
| hk_epoch_ets[0] + timedelta(hours=PIVOT_HK_HOUR_RANGE[1]).total_seconds() | ||
| ) |
There was a problem hiding this comment.
Fragile code. Nominal pointings are close to 24 hours, but not all pointings are that long. For example around the TCM on April 7, the repoint table has the following:
513165615,0,513165816,0,2026-04-06 10:00:00.748931,2026-04-06 10:03:21.748756,208
513252017,0,513252218,0,2026-04-07 10:00:02.673645,2026-04-07 10:03:23.673469,209
513287744,0,513287946,0,2026-04-07 19:55:29.642514,2026-04-07 19:58:51.642338,210
513288856,0,513289642,0,2026-04-07 20:14:01.641545,2026-04-07 20:27:07.640860,211
513338414,0,513338796,0,2026-04-08 09:59:59.598459,2026-04-08 10:06:21.598127,212
Pointing 209 is ~9:52 in duration, pointing 210 is ~0:16 in duration, etc.
There was a problem hiding this comment.
I'll bring this up with @nschwadron tomorrow..
There was a problem hiding this comment.
Good point. The current implementation assumes a nominal long pointing and uses a fixed 3–15 hour window from the beginning of the HK file to estimate the pivot angle. That approach may not be robust for shortened pointings, such as those around TCM activities. Defining the HK selection window dynamically based on the actual pointing duration sounds like a better approach. I would recommend applying only a small edge trim to avoid transition periods.
There was a problem hiding this comment.
@tmplummer - my understanding from @frahmanif is that instead of a +3hr and +15hr offset from the start of the hk file, we'll do a +p hr offset from the start and -q hr offset from the end for the window (both constants in constants.py. Around an hour to start. I'll implement this change tomorrow, unless you see a problem with this approach
There was a problem hiding this comment.
Ok, that would be an improvement, but will break if the pointing is less than 2 hours long.
There was a problem hiding this comment.
Pointings shorter than ~2 hours are most likely associated with tests or special operational modes and probably would not need to be included in the nominal goodtimes list. I will double-check this with Nathan, but my understanding is that we should likely define a minimum pointing duration required for a pointing to qualify for the goodtimes analysis.
|
Does this work have an associated issue? It would be good to keep with best practices of capturing all work in a issue and linking PRs using the "Closes: #nnnn" |
|
Opened issue #3135 for this PR specifically. |
| } | ||
|
|
||
| # One histogram accumulation cycle duration [s] | ||
| HISTOGRAM_CYCLE_EPOCHS: int = 420 |
There was a problem hiding this comment.
Does it matter that this is just an estimate? I am assuming this is 7 ESA steps * 4 spins/step * 15 seconds/spin. But the true spin duration is not 15 seconds. This is the type of hard coded value that adds lots of technical debt.
It looks like N_ESA_LEVELS is defined below, so perhaps this should actually be:
HISTOGRAM_CYCLE_EPOCHS = N_ESA_LEVELS * N_SPINS_PER_ESA_LEVEL * 15?
@vineetbansal If this is going to stay as is, please add a TODO and link it to a github issue.
There was a problem hiding this comment.
Good catch! I've introduced a N_SPINS_PER_ESA_LEVEL and am deriving HISTOGRAM_CYCLE_EPOCHS from it now. 2 other existing places that had a hardcoded 4 now refer to N_SPINS_PER_ESA_LEVEL instead.
For the spin duration, I've added a NOMINAL_SPIN_PERIOD_SEC: float = 15.0, with an explanation that it is not exact. I couldn't find another place in the code where I could grab this "constant". Hope this works for now.
| 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} |
There was a problem hiding this comment.
I envision this will also want to be changed in the future.
| start_et_hk = ( | ||
| hk_epoch_ets[0] + timedelta(hours=PIVOT_HK_HOUR_RANGE[0]).total_seconds() | ||
| ) | ||
| end_et_hk = ( | ||
| hk_epoch_ets[0] + timedelta(hours=PIVOT_HK_HOUR_RANGE[1]).total_seconds() | ||
| ) |
There was a problem hiding this comment.
Ok, that would be an improvement, but will break if the pointing is less than 2 hours long.
tmplummer
left a comment
There was a problem hiding this comment.
Looks good once the checks pass.
|
@tmplummer - for the time window to get a median pivot angle, @nschwadron mentioned that he'd think about it (his idea was slightly different from what @frahmanif suggested above). I've opened an issue #3169 on this so we can revisit it (shortly in the next couple of days I think). |
15f176b
into
IMAP-Science-Operations-Center:dev
Change Summary
Changed the
goodtimesLo/l1b product algorithm. Both the algorithm as well as the structure of the output datasets have changed. I've run the algorithm by the instrument team. Since no other products depend on these, this should be okay.Overview
File changes
l1b_bgrates_and_goodtimesfunction inimap_processing/lo/l1b/lo_l1b.pychanged to adhere to new algorithm from IMAP-Lo team (not yet officially documented). Tests related to this functionl1b_bgrates_and_goodtimeshave been tweaked.Testing
Modified tests to test some edge cases for the new algorithm. Not all edge cases have been tested, but I'll add more in a subsequent commit.