Skip to content

Conversation

@natinew77-creator
Copy link

Summary

This PR 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.

Addresses #13353

Changes

mne/io/nirx/nirx.py

  • Added a note in the read_raw_nirx docstring explaining the directory requirement
  • Clarified that passing a file path will result in an error
  • Added suggestion to use read_raw_snirf for .snirf files

tutorials/io/30_reading_fnirs_data.py

  • Added an important note in the fNIRS tutorial with:
    • Correct vs incorrect usage examples
    • Troubleshooting guidance for the OSError
    • Alternative for SNIRF format files

Testing

Documentation-only change. No new tests required.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 #13353

Reference issue (if any)

What does this implement/fix?

Additional information

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
) -> "RawNIRX":
"""Reader for a NIRX fNIRS recording.
.. note::
Copy link
Member

Choose a reason for hiding this comment

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

This should probably go in the Notes section (new one if needed) rather than adding a big note at the top

version 15.0 and above and Aurora version 2021 and above.
MNE-Python supports reading data from NIRScout and NIRSport devices.
.. important::
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we need to go into this detail in an example... the docstring update should be good enough

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.
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.

how to read my own nirs file with MNE?

2 participants