-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mne_bids.path.BIDSPath.fpath ignores value of 'check' #1123
Comments
how can we replicate this?
|
Make a dummy dataset with a single file of a non-BIDS compliant type: root='dummyBidsSet' Filetree: Run:
This returns the following (for me): [BIDSPath( ValueError Traceback (most recent call last) File c:\Users\au207178\Anaconda3\envs\cuda11\lib\site-packages\mne_bids\path.py:600, in BIDSPath.fpath(self) File c:\Users\au207178\Anaconda3\envs\cuda11\lib\site-packages\mne_bids\path.py:1059, in _get_matching_bidspaths_from_filesystem(bids_path) ValueError: No electrophysiological data found. However,
describes the full path to the file in question: |
I can replicate with this self contained code snippet: from pathlib import Path
import numpy as np
import mne_bids
A = np.random.rand(5,5)
fname = Path("./bids_data/sub-001/ses-001/sub-001_ses-001_task-sleep_desc-hypnogram.npz")
fname.parent.mkdir(parents=True, exist_ok=True)
np.savez_compressed(fname, A=A)
root = './bids_data'
bp = mne_bids.find_matching_paths(root=root)[0]
bp.update(check=False)
print(bp.basename + bp.extension)
bp.fpath # Crash for no good reason I agree this should work |
Description of the problem
I am structuring my derivative folders according to BIDS structure, and using mne-bids to identify files in there, even if the data types are no longer standard BIDS types.
Steps to reproduce
Python
For example:
This correctly identifies 4 files for me:
hypnoFiles = mb.find_matching_paths(root=hypnoDerivPath,extensions='.npz',subjects=subject)
However, calling fpath on any of these files throws up an error, even when check=False:
Expected results
I expect hypnoFile.fpath to print the location of the file when check=False.
Actual results
This is the error:
Additional information
However, all information for locating the file is clearly available to fpath:
print(os.path.join(hypnoFile.directory,hypnoFile.basename+hypnoFile.extension))
Works fine as a workaraound.
The text was updated successfully, but these errors were encountered: