From d1f70e5753583856b8fa26d724782f5568b74c4b Mon Sep 17 00:00:00 2001 From: dog Date: Thu, 9 Jul 2026 17:37:01 +0800 Subject: [PATCH] fix: remove duplicate soften_forward definition (cherry-pick artifact) Co-Authored-By: Claude Fable 5 --- src/ai_mouse/_postprocess.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/ai_mouse/_postprocess.py b/src/ai_mouse/_postprocess.py index a737d63..19f8bcd 100644 --- a/src/ai_mouse/_postprocess.py +++ b/src/ai_mouse/_postprocess.py @@ -92,42 +92,6 @@ def enforce_forward_monotonic(forward: np.ndarray) -> np.ndarray: return forward -def soften_forward( - forward: np.ndarray, - backtrack_tol: float = 0.02, - overshoot_span: float = 0.08, -) -> np.ndarray: - """Softly regularise the forward axis without destroying natural motion. - - Real trajectories contain small backward corrections and overshoot - past the target; hard clipping turns both into visible artifacts - (stacked points, vertical walls). Instead: - - - Backtracking is tolerated up to ``backtrack_tol``; larger dips are - raised to ``prev - backtrack_tol``. - - Values above 1.0 are compressed with tanh so they asymptote at - ``1 + overshoot_span`` (moderate overshoot survives, extremes - cannot fly far past the target). - - No lower clip: the endpoint warp pins the first point later. - - Args: - forward: (T,) forward coordinates. - backtrack_tol: max allowed per-step regression. - overshoot_span: asymptotic max excess above 1.0. - - Returns: - New (T,) array. - """ - out = forward.copy() - for i in range(1, len(out)): - floor = out[i - 1] - backtrack_tol - if out[i] < floor: - out[i] = floor - over = out > 1.0 - out[over] = 1.0 + overshoot_span * np.tanh((out[over] - 1.0) / overshoot_span) - return out - - def damp_start(lateral: np.ndarray, n: int = 4) -> np.ndarray: """Dampen lateral oscillation over the first ``n`` points, continuously.