PostProcess.py: add guardrail tests and fix OOM memory inefficiencies#2
Merged
dprim7 merged 3 commits intohh4b-refactorfrom Feb 20, 2026
Merged
Conversation
Co-authored-by: dprim7 <38478631+dprim7@users.noreply.github.com>
Co-authored-by: dprim7 <38478631+dprim7@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add unit and integration tests for PostProcess functionalities
PostProcess.py: add guardrail tests and fix OOM memory inefficiencies
Feb 20, 2026
Owner
|
@copilot make PR into new branch called hh4b-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PostProcess.pycaused OOM crashes due to redundant in-memory DataFrame copies accumulating across the per-sample processing loop inload_process_run3_samples.Tests (
tests/test_postprocess.py)35 new unit and integration tests covering all key pure-Python functions:
add_bdt_scores— binary, 3-class, 4-class, 5-class; with/without JEC shift suffixget_jets_for_txbb_sf— all process type branchesget_nevents_data/signal/nosignal— sideband counting, mass window selection, cut maskingfom_classic/fom_update— basic cases, zero-signal/background edges, ABCD correctionMemory fixes (
load_process_run3_samples)1. Progressive jshift merge — eliminates holding all JEC/JMR shift DataFrames simultaneously before concat:
2. Direct column assignment for
more_varsandvariation_vars— removes two intermediatepd.DataFrame()+pd.concat()round-trips:3. Eager
events_dictdeletion — frees the full raw sample DataFrame (the largest object per iteration) immediately after its last use (calculate_trigger_weights), rather than holding it alongside the growingbdt_eventsfor the rest of the loop body.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.