diff --git a/pylossless/bids.py b/pylossless/bids.py index 90ba861..f003e18 100644 --- a/pylossless/bids.py +++ b/pylossless/bids.py @@ -78,7 +78,7 @@ def convert_recording_to_bids( write_kwargs["allow_preload"] = True write_raw_bids( - raw, bids_path=bids_path, events_data=events, event_id=event_id, **write_kwargs + raw, bids_path=bids_path, events=events, event_id=event_id, **write_kwargs ) return bids_path diff --git a/pylossless/tests/test_bids.py b/pylossless/tests/test_bids.py new file mode 100644 index 0000000..2293ba2 --- /dev/null +++ b/pylossless/tests/test_bids.py @@ -0,0 +1,29 @@ +import pylossless as ll +import mne +import numpy as np +import pytest +import shutil + + +@pytest.mark.filterwarnings("ignore:Converting data files to EDF format") +def test_convert_dataset_to_bids(tmp_path): + """Make sure MNE's annotate_break function can run.""" + def edf_import_fct(path_in): + # read in a file + raw = mne.io.read_raw_edf(path_in, preload=True) + print(raw.annotations) + return raw, np.array([[0, 0, 0]]), {"test": 0, "T0": 1, "T1": 2, "T2": 3} + + testing_path = mne.datasets.testing.data_path() + fname = testing_path / "EDF" / "test_edf_overlapping_annotations.edf" + import_args = [{"path_in": fname}] + bids_path_args = [{'subject': '001', 'run': '01', 'session': '01', + "task": "test"}] + ll.bids.convert_dataset_to_bids( + edf_import_fct, + import_args, + bids_path_args, + bids_root=tmp_path / "bids_dataset", + overwrite=True + ) + shutil.rmtree(tmp_path / "bids_dataset")