-
Notifications
You must be signed in to change notification settings - Fork 10
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
TypeError: write_raw_bids() got an unexpected keyword argument 'events_data'" #175
Comments
I think MNE-BIDS renamed the |
Confirmed. |
Nevermind.. We already pin to MNE-BIDS 0.14. As @christian-oreilly said, looks like we are lacking a test for |
Yeah. I'll fish some old code. I was using this in the README some time back... so maybe this can be put in a test with the PR solving this. |
Fetched from the history... BIDSificationPyLossless provides some functions to help the user import non-BIDS recordings. Since the code to import datasets recorded in different formats and with different properties can vary much from one project to the next, the user must provide a function that can load and return a # Example of importing function
import tempfile
def egi_import_fct(path_in, stim_channel):
# read in a file
raw = mne.io.read_raw_egi(path_in, preload=True)
# events and event IDs for events sidecar
events = mne.find_events(raw, stim_channel=['STI 014'])
event_id = raw.event_id
# MNE-BIDS doesn't currently support RawMFF objects.
with tempfile.TemporaryDirectory() as temp_dir:
raw.save(Path(temp_dir) / "tmp_raw.fif")
# preload=True is important since this file is volatile
raw = mne.io.read_raw_fif(Path(temp_dir) / 'tmp_raw.fif', preload=True)
# we only want EEG channels in the channels sidecar
raw.pick_types(eeg=True, stim=False)
raw.rename_channels({'E129': 'Cz'}) # to make compatible with montage
return raw, events, event_id Then, the dataset can be converted to BIDS as follows import_args = [{"stim_channel": 'STI 014', "path_in": './sub-s004-ses_07_task-MMN_20220218_022348.mff'},
{"stim_channel": 'STI 014', "path_in": './sub-s004-ses_07_task-MMN_20220218_022348.mff'}]
bids_path_args = [{'subject': '001', 'run': '01', 'session': '01', "task": "mmn"},
{'subject': '002', 'run': '01', 'session': '01', "task": "mmn"}]
bids_paths = ll.bids.convert_to_bids(egi_import_fct, import_args, bids_path_args, overwrite=True) Note that, in this case, we used twice the same input file just to demonstrate how this function can be used for multiple recordings. In practice, a user may want to have this information stored in CSV files that can be readily used. For example, if we create such files for the demonstration: import pandas as pd
pd.DataFrame(import_args).to_csv("import_args.csv", index=False)
pd.DataFrame(bids_path_args).to_csv("bids_path_args.csv", index=False) Now, regardless of how such files have been produced (e.g., from Excel), these can be used directly to process the whole dataset: import_args = list(pd.read_csv("import_args.csv").T.to_dict().values())
bids_path_args = list(pd.read_csv("bids_path_args.csv").T.to_dict().values())
bids_paths = ll.bids.convert_to_bids(egi_import_fct, import_args, bids_path_args, overwrite=True)
pipeline.run_dataset(bids_paths) |
@scott-huberty I think the only challenge is that we don't have such a test file in the repo. Apparently, that file was also not part of the repo at this point in time... I am not sure if it was ever included. |
I did find it in some old code archive on my local computer, though. That file was 761.1 MB. Maybe it can be cropped to a more reasonable size (~1MB?) and included? I suppose this was one of our internal Q1k piloting on you or me. |
@christian-oreilly Maybe we can just use one of MNE's test files to create a "dummy" dataset (repeatedly using one file) like your previous example did?
|
Yeah... I ended up doing something like that. I copied a snippet from another test and used testing_path = mne.datasets.testing.data_path()
fname = testing_path / "EDF" / "test_edf_overlapping_annotations.edf" Test written and successful locally. |
* Fix bug issue #175 * Code linting. * Update pylossless/tests/test_bids.py Co-authored-by: Scott Huberty <[email protected]> * Update pylossless/tests/test_bids.py Co-authored-by: Scott Huberty <[email protected]> * Update pylossless/tests/test_bids.py Co-authored-by: Scott Huberty <[email protected]> * Remove print, clean test files, rename test. --------- Co-authored-by: Scott Huberty <[email protected]>
Error reported by @Deepa-Tilwani on Discord.
The text was updated successfully, but these errors were encountered: