Skip to main content
← Lab

discordflip

confirmedupstream bugPython · stumpySystems & data structuresJuly 25, 2026

the question

Does stumpy's `_subspace` return the most anomalous dimensions when `discords=True`?

what came out

stumpy's `_subspace` discord branch sorts the reversed distance array with `D[::-1].argsort()` and uses the reversed positions as dimension indices, yielding `ndim-1-argmin(D)` instead of `argmax(D)`. On `D=[10,5,8]` it returns the least-anomalous dimension; the motif branch is correct. Fix: `(-D).argsort(axis=0, kind="mergesort")`.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/discordflip