From c0f166596edfc66e9ad15f7891048d27de08b803 Mon Sep 17 00:00:00 2001 From: Shresth Keshari Date: Wed, 26 Feb 2025 23:09:20 +0530 Subject: [PATCH] Solving issue #13122: Aiming to achieve better sensitivity of head movement detection for chpi extraction (#13123) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/changes/devel/13123.bugfix.rst | 1 + doc/changes/names.inc | 1 + mne/chpi.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 doc/changes/devel/13123.bugfix.rst diff --git a/doc/changes/devel/13123.bugfix.rst b/doc/changes/devel/13123.bugfix.rst new file mode 100644 index 00000000000..ceefe244e54 --- /dev/null +++ b/doc/changes/devel/13123.bugfix.rst @@ -0,0 +1 @@ +Fixed CTF cHPI coil location detection in :func:`mne.chpi.extract_chpi_locs_ctf` by :newcontrib:`Shresth Keshari`. diff --git a/doc/changes/names.inc b/doc/changes/names.inc index a87adaf3047..0d5ee6a5c73 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -277,6 +277,7 @@ .. _Senwen Deng: https://snwn.de .. _Seyed Yahya Shirazi: https://neuromechanist.github.io .. _Sheraz Khan: https://github.com/SherazKhan +.. _Shresth Keshari: https://github.com/shresth-keshari .. _Shristi Baral: https://github.com/shristibaral .. _Silvia Cotroneo: https://github.com/sfc-neuro .. _Simeon Wong: https://github.com/dtxe diff --git a/mne/chpi.py b/mne/chpi.py index d04081779c9..f3e04cd21b3 100644 --- a/mne/chpi.py +++ b/mne/chpi.py @@ -234,7 +234,7 @@ def extract_chpi_locs_ctf(raw, verbose=None): # find indices where chpi locations change indices = [0] - indices.extend(np.where(np.all(np.diff(chpi_data, axis=1), axis=0))[0] + 1) + indices.extend(np.where(np.any(np.diff(chpi_data, axis=1), axis=0))[0] + 1) # data in channels are in ctf device coordinates (cm) rrs = chpi_data[:, indices].T.reshape(len(indices), 3, 3) # m # map to mne device coords