Skip to content

Commit 645cb12

Browse files
Fix bug issue #175 (#176)
* 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]>
1 parent b3a481b commit 645cb12

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

pylossless/bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def convert_recording_to_bids(
7878
write_kwargs["allow_preload"] = True
7979

8080
write_raw_bids(
81-
raw, bids_path=bids_path, events_data=events, event_id=event_id, **write_kwargs
81+
raw, bids_path=bids_path, events=events, event_id=event_id, **write_kwargs
8282
)
8383

8484
return bids_path

pylossless/tests/test_bids.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import pylossless as ll
2+
import mne
3+
import numpy as np
4+
import pytest
5+
import shutil
6+
7+
8+
@pytest.mark.filterwarnings("ignore:Converting data files to EDF format")
9+
def test_convert_dataset_to_bids(tmp_path):
10+
"""Make sure MNE's annotate_break function can run."""
11+
def edf_import_fct(path_in):
12+
# read in a file
13+
raw = mne.io.read_raw_edf(path_in, preload=True)
14+
print(raw.annotations)
15+
return raw, np.array([[0, 0, 0]]), {"test": 0, "T0": 1, "T1": 2, "T2": 3}
16+
17+
testing_path = mne.datasets.testing.data_path()
18+
fname = testing_path / "EDF" / "test_edf_overlapping_annotations.edf"
19+
import_args = [{"path_in": fname}]
20+
bids_path_args = [{'subject': '001', 'run': '01', 'session': '01',
21+
"task": "test"}]
22+
ll.bids.convert_dataset_to_bids(
23+
edf_import_fct,
24+
import_args,
25+
bids_path_args,
26+
bids_root=tmp_path / "bids_dataset",
27+
overwrite=True
28+
)
29+
shutil.rmtree(tmp_path / "bids_dataset")

0 commit comments

Comments
 (0)