Skip to content

Fix scipy.stats.mode usage for keepdims=False default (scipy>=1.11) - #3409

Merged
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/scipy-mode-keepdims
Jul 16, 2026
Merged

Fix scipy.stats.mode usage for keepdims=False default (scipy>=1.11)#3409
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/scipy-mode-keepdims

Conversation

@Denny-Hwang

Copy link
Copy Markdown
Contributor

SORTEllipse.track indexed mode(identities[i])[0][0]. Since scipy 1.11 mode defaults to keepdims=False, so mode(1d)[0] is already a scalar and the second [0] raises IndexError. Pass keepdims=False explicitly and take a single [0], matching the pattern already used in refine_training_dataset/stitch.py.

These sites are in the identity-aware branch of SORTEllipse.track, which is currently only reached when 'identities' is passed to track() (no in-tree caller does), so this is a latent fix rather than a live regression.

SORTEllipse.track indexed mode(identities[i])[0][0]. Since scipy 1.11
mode defaults to keepdims=False, so mode(1d)[0] is already a scalar and
the second [0] raises IndexError. Pass keepdims=False explicitly and
take a single [0], matching the pattern already used in
refine_training_dataset/stitch.py.

These sites are in the identity-aware branch of SORTEllipse.track,
which is currently only reached when 'identities' is passed to track()
(no in-tree caller does), so this is a latent fix rather than a live
regression.
@C-Achard C-Achard added the bug fix! fix for a real buggy one... label Jul 15, 2026
@C-Achard
C-Achard changed the base branch from main to external/hwang-misc-fixes July 16, 2026 07:36
@C-Achard
C-Achard merged commit e0f4abf into DeepLabCut:external/hwang-misc-fixes Jul 16, 2026
10 checks passed
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