Skip to content

Conversation

@natinew77-creator
Copy link

@natinew77-creator natinew77-creator commented Dec 11, 2025

Summary
This PR improves the documentation for read_raw_nirx to clarify that it expects a directory path (or a header file path within that directory), addressing common user confusion that can lead to an OSError.

Addresses #13353

Changes

  • Updated the fname parameter description in read_raw_nirx to explicitly mention directory paths or the .hdr header file.
  • Centralized the NIRX directory warning note in mne/utils/docs.py.

This improves the documentation for read_raw_nirx to prevent the common
'OSError: Need a directory for fname but found a file' error that users
encounter when passing a single file path instead of a directory path.

Changes:
- Added a note in the read_raw_nirx docstring explaining the directory
  requirement and suggesting read_raw_snirf for .snirf files
- Added an important note in the fNIRS tutorial with correct/incorrect
  examples and troubleshooting guidance

Fixes mne-tools#13353
Address review comments from @larsoner: move directory clarification to Notes section in read_raw_nirx and remove redundant warning in tutorial.
This ensures the clarification appears in both read_raw_nirx and RawNIRX documentation while maintaining cleaner docstring code.
Incorporated feedback to format the directory requirement as a proper admonition note.
@natinew77-creator natinew77-creator force-pushed the doc/clarify-read-raw-nirx-directory-requirement branch from a680ff4 to 8cf299e Compare December 25, 2025 23:17
Copilot AI review requested due to automatic review settings December 25, 2025 23:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the documentation for read_raw_nirx to clarify that it expects a directory path (or header file path within that directory), addressing a common user error where single file paths cause an OSError.

Key changes:

  • Enhanced the fname parameter description in read_raw_nirx to explicitly state it accepts a directory or .hdr file path
  • Added a note in the shared docstring explaining the directory requirement and suggesting read_raw_snirf for .snirf files

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
mne/utils/docs.py Added a note to the nirx_notes docstring clarifying the directory requirement for fname and suggesting an alternative for .snirf files
mne/io/nirx/nirx.py Updated the fname parameter description to explicitly explain it accepts a directory containing NIRX files or the .hdr header file within that folder

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants