Skip to content

Fix harpy.kicker._get_damping() reversing/accumulating on the wrong axis - #591

Open
MAVRICK-1 wants to merge 1 commit into
pylhc:masterfrom
MAVRICK-1:bugfix/kicker-damping-axis
Open

MAVRICK-1 wants to merge 1 commit into
pylhc:masterfrom
MAVRICK-1:bugfix/kicker-damping-axis

Conversation

@MAVRICK-1

@MAVRICK-1 MAVRICK-1 commented Sep 10, 2026

Copy link
Copy Markdown

bpm_data has shape (n_bpms, n_turns). bpm_data[::-1] reversed the BPM axis (0) and np.maximum.accumulate defaulted to axis 0 too, so the function took a running max across different BPMs instead of building each BPM's decay envelope over turns. This produced a sign-flipped, ~198% wrong damping estimate, corrupting the free-kick phase correction in phase_correction() (runs whenever is_free_kick is set).

Fix: reverse and accumulate over the turn axis (axis=1) instead.

Includes a regression test with synthetic data at a known ground-truth decay rate, which failed before this fix and passes after it.

Fixes #590

bpm_data has shape (n_bpms, n_turns). bpm_data[::-1] reversed the BPM
axis (0) and np.maximum.accumulate defaulted to axis 0 too, so the
function took a running max across different BPMs instead of building
each BPM's decay envelope over turns. This produced a sign-flipped,
~198% wrong damping estimate, corrupting the free-kick phase
correction in phase_correction() (runs whenever is_free_kick is set).

Fix: reverse and accumulate over the turn axis (axis=1) instead.

Includes a regression test with synthetic data at a known
ground-truth decay rate, which failed before this fix and passes
after it.
@MAVRICK-1
MAVRICK-1 requested a review from a team as a code owner September 10, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: harpy.kicker._get_damping() reverses/accumulates along the wrong axis, producing sign-flipped damping estimates

1 participant