FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix operator precedence in condition NaN/non-positive mask by Denny-Hwang · Pull Request #3408 · DeepLabCut/DeepLabCut · GitHub

Fix operator precedence in condition NaN/non-positive mask - #3408

Merged
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/conds-mask-precedence
Jul 16, 2026
Merged

Fix operator precedence in condition NaN/non-positive mask#3408
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/conds-mask-precedence

Conversation

Copy link
Copy Markdown
Contributor

The mask 'conds <= 0 | np.isnan(conds)' parses as
'conds <= (0 | np.isnan(conds))' because bitwise | binds tighter than the <= comparison, so the NaN check was not OR-ed with the non-positive check as intended. Parenthesize to '(conds <= 0) | np.isnan(conds)'.

Verified: for conds=[0.5, -0.1, nan] the buggy expression yields [False, True, False] (misses the NaN), while the fixed expression yields [False, True, True].

The mask 'conds <= 0 | np.isnan(conds)' parses as
'conds <= (0 | np.isnan(conds))' because bitwise | binds tighter than
the <= comparison, so the NaN check was not OR-ed with the
non-positive check as intended. Parenthesize to '(conds <= 0) |
np.isnan(conds)'.

Verified: for conds=[0.5, -0.1, nan] the buggy expression yields
[False, True, False] (misses the NaN), while the fixed expression
yields [False, True, True].
C-Achard added the bug fix! fix for a real buggy one... label Jul 15, 2026
C-Achard changed the base branch from main to external/hwang-misc-fixes July 16, 2026 07:36
C-Achard merged commit 2271e6d into DeepLabCut:external/hwang-misc-fixes Jul 16, 2026
10 checks passed
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

Labels

bug fix! fix for a real buggy one...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL