Skip to content

Commit dcc7116

Browse files
Aniketsydrammock
andauthored
Allow reading alternative nasion label (Nz) from snirf file (#13672)
Co-authored-by: Daniel McCloy <dan@mccloy.info>
1 parent c089d85 commit dcc7116

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

doc/changes/dev/13672.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow reading alternative nasion label ("Nz") in SNIRF files when parsing landmarkPos3D, by :newcontrib:`Aniket Singh Yadav`.

doc/changes/names.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
.. _Andrew Gilbert: https://github.com/adgilbert
2323
.. _Andrew Quinn: https://github.com/ajquinn
2424
.. _Aniket Pradhan: https://github.com/Aniket-Pradhan
25+
.. _Aniket Singh Yadav: https://github.com/Aniketsy
2526
.. _Anna Padee: https://github.com/apadee/
2627
.. _Annalisa Pascarella: https://github.com/annapasca
2728
.. _Anne-Sophie Dubarry: https://github.com/annesodub

mne/io/snirf/_snirf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def natural_keys(text):
399399
dign = dign.lower()
400400
if dign in [b"lpa", b"al"]:
401401
lpa = diglocs[idx, :3]
402-
elif dign in [b"nasion"]:
402+
elif dign in [b"nasion", b"nz"]:
403403
nasion = diglocs[idx, :3]
404404
elif dign in [b"rpa", b"ar"]:
405405
rpa = diglocs[idx, :3]

mne/io/tests/test_raw.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,16 @@ def _test_raw_reader(
520520
# make sure that dig points in head coords implies that fiducials are
521521
# present
522522
if len(raw.info["dig"] or []) > 0:
523-
card_pts = [
524-
d for d in raw.info["dig"] if d["kind"] == _dig_kind_dict["cardinal"]
523+
card_pts_head = [
524+
d
525+
for d in raw.info["dig"]
526+
if d["kind"] == _dig_kind_dict["cardinal"]
527+
and d["coord_frame"] == FIFF.FIFFV_COORD_HEAD
525528
]
526529
eeg_dig_head = [d for d in eeg_dig if d["coord_frame"] == FIFF.FIFFV_COORD_HEAD]
527530
if len(eeg_dig_head):
528-
assert len(card_pts) == 3, "Cardinal points missing"
529-
if len(card_pts) == 3: # they should all be in head coords then
531+
assert len(card_pts_head) == 3, "Cardinal points missing"
532+
if len(card_pts_head) == 3: # they should all be in head coords then
530533
assert len(eeg_dig_head) == len(eeg_dig)
531534

532535
return raw

0 commit comments

Comments
 (0)