Skip to content

FIX: Handle empty landmarkLabels in read_raw_snirf#13628

Merged
larsoner merged 2 commits intomne-tools:mainfrom
bruAristimunha:fix-fnris-reading
Feb 3, 2026
Merged

FIX: Handle empty landmarkLabels in read_raw_snirf#13628
larsoner merged 2 commits intomne-tools:mainfrom
bruAristimunha:fix-fnris-reading

Conversation

@bruAristimunha
Copy link
Contributor

Summary

Fixes #13627

read_raw_snirf raises TypeError: iteration over a 0-d array when reading SNIRF files where /nirs/probe/landmarkLabels exists but is empty or scalar.

Changes

  • Added check for empty or 0-d landmarkLabels arrays before iteration in _snirf.py
  • Added test test_snirf_empty_landmark_labels to cover this edge case

Testing

  • All 30 SNIRF tests pass
  • Tested with real file from OpenNeuro ds005929 that triggered the original bug

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @bruAristimunha !

@larsoner
Copy link
Member

larsoner commented Feb 3, 2026

Failures are just #13632, in it goes

@larsoner larsoner merged commit 1138f8b into mne-tools:main Feb 3, 2026
29 of 32 checks passed
larsoner added a commit to teonbrooks/mne-python that referenced this pull request Feb 4, 2026
* upstream/main:
  MAINT: Work around pandas deprecation (mne-tools#13632)
  FIX: Handle empty landmarkLabels in read_raw_snirf (mne-tools#13628)
  Implement the MEF3 support (mne-tools#13610)
  BUG: Fix bug with somato dataset paths (mne-tools#13630)
  DOC: Move mne-kit-gui (mne-tools#13629)
  fix team name for inactivity tool [ci skip] (mne-tools#13626)
  MAINT: Update dependency specifiers (mne-tools#13625)
  MAINT: Update dependency specifiers (mne-tools#13611)
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_raw_snirf fails with TypeError when landmarkLabels is empty

2 participants