Stabilize scalar DVS normal-flow normalization - #4981
Conversation
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
|
Closing as low value. The change is dedicated to normalization at near-maximum floating-point magnitudes (around 1e308), where the downstream geometry is not a meaningful supported operating regime. The added special-case path would increase maintenance complexity without practical benefit. |

Bug
pyrecest.experimental.dvs.signed_normal_flow()normalized contour normals and velocities withnumpy.linalg.norm. For large but finite vectors such as[1e308, 1e308], the internal sum of squares overflows even though the true Euclidean norm remains representable.For a horizontal normal and a 45-degree velocity at that scale, the helper returned
0.0instead ofsqrt(0.5). With NumPy overflow handling configured to raise, it raisedFloatingPointError. The profile and activity helpers inherit the same failure because they call this scalar path.The vectorized DVS tracker path already uses scale-safe velocity normalization, but the public scalar active-contour helpers remained vulnerable.
Fix
numpy.hypot.reducehelper;Validation
0.0instead of0.7071067811865475;FloatingPointErrorundernumpy.errstate(over="raise", invalid="raise");[sqrt(0.5), sqrt(0.5), -sqrt(0.5)]without overflow;main;GitHub Actions should provide the full supported Python, backend, lint, packaging, documentation, and security validation matrix.