Skip to content

Correct formula for mad (and std) in drift quality metrics#4355

Merged
alejoe91 merged 1 commit intoSpikeInterface:mainfrom
ecobost:drift_mad
Feb 2, 2026
Merged

Correct formula for mad (and std) in drift quality metrics#4355
alejoe91 merged 1 commit intoSpikeInterface:mainfrom
ecobost:drift_mad

Conversation

@ecobost
Copy link
Copy Markdown
Contributor

@ecobost ecobost commented Jan 30, 2026

Three small changes to drift metrics:

  1. Changed mean in mad to median (to conform to standard mad definition)
  2. Get rid of np.abs inside the std calculation. Before, one branch (when drift has nans) computed std(abs(drift)) and the other computed std(drift), I presume we only really just want the std(drift).
  3. Drop the unnecessary outer nan check; nanmean(x) == mean(x) if x has no nans so no use to have that as a separate check.

Tested locally, mad and some std values change, rest remain the same.

@alejoe91 alejoe91 added the metrics Related to metrics module label Feb 2, 2026
Copy link
Copy Markdown
Member

@alejoe91 alejoe91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks great!

@alejoe91 alejoe91 merged commit 28c4403 into SpikeInterface:main Feb 2, 2026
15 checks passed
@ecobost ecobost deleted the drift_mad branch February 2, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metrics Related to metrics module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants