Skip to content

BUG: support named cardinal fiducials (nasion, lpa, rpa) in read_dig_hpts - #14540

Open
boomesh11 wants to merge 1 commit into
mne-tools:mainfrom
boomesh11:fix/read-dig-hpts-named-cardinals
Open

boomesh11 wants to merge 1 commit into
mne-tools:mainfrom
boomesh11:fix/read-dig-hpts-named-cardinals

Conversation

@boomesh11

Copy link
Copy Markdown

Fixes #14538.

Problem

ead_dig_hpts() in mne/channels/montage.py only mapped numeric cardinal labels ("1", "2", "3") in id_idx_to_label. BioSemi .hpts files (including mne/io/edf/tests/data/biosemi.hpts) use named cardinal labels (
asion, lpa,
pa), causing KeyError: 'nasion'.

Fix

  • Extended id_idx_to_label in
    ead_dig_hpts() to accept "lpa", "nasion", and "rpa" (case-insensitively via .lower()), alongside "1", "2", and "3".

Verification

  • Extended est_read_dig_hpts in mne/channels/tests/test_montage.py to also read mne/io/edf/tests/data/biosemi.hpts and verify its 3 fiducials and 64 channels.
  • Ran pytest -o addopts="" --noconftest mne/channels/tests/test_montage.py -k "test_read_dig_hpts": 1 passed.

@welcome

welcome Bot commented Nov 16, 2026

Copy link
Copy Markdown

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴

@larsoner

Copy link
Copy Markdown
Member

Can you add a changelog entry with the :newcontrib: label? Was AI used as part of this contribution?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_dig_hpts crashes on BioSemi-style .hpts with named cardinal fiducials

2 participants