Skip to content

Commit

Permalink
[FIX] Make outlier detection robust to nans (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbara committed Dec 8, 2023
1 parent e60074b commit 9204cfd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions citation.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
given-names: "Nicolas"
orcid: "https://orcid.org/0000-0003-1495-561X"
title: "MEEGkit"
version: 0.1.6
version: 0.1.7
doi: 10.5281/zenodo.10210992
date-released: 2023-11-28
date-released: 2023-12-08
url: "https://github.com/nbara/python-meegkit"
2 changes: 1 addition & 1 deletion meegkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""M/EEG denoising utilities in python."""
__version__ = "0.1.6"
__version__ = "0.1.7"

from . import asr, cca, detrend, dss, lof, ress, sns, star, trca, tspca, utils

Expand Down
6 changes: 3 additions & 3 deletions meegkit/utils/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def find_outlier_trials(X, thresh=None, show=True):
else:
n_chans, n_trials = X.shape

avg = np.mean(X, axis=-1, keepdims=True) # mean over trials
avg = np.nanmean(X, axis=-1, keepdims=True) # mean over trials
d = X - avg # difference from mean
d = np.sum(d ** 2, axis=0)
d = np.nansum(d ** 2, axis=0)

d = d / (np.sum(X ** 2) / n_trials)
d = d / (np.nansum(X ** 2) / n_trials)
idx = np.where(d < thresh[0])[0]

if show:
Expand Down

0 comments on commit 9204cfd

Please sign in to comment.