Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b72ccb

Browse files
committed
added initial BIDS import/export/preproc support
1 parent 28dafba commit 0b72ccb

File tree

11 files changed

+1388
-2
lines changed

11 files changed

+1388
-2
lines changed

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,20 @@ dependencies = [
2626
"oct2py>=5.5.0",
2727
"torch>=1.10.0",
2828
"h5py>=3.3.0",
29+
"pybids>=0.4",
30+
"pyedflib>=0.1.42",
2931
"python-picard",
30-
"h5py"
32+
"neo",
33+
"pynvml",
34+
"psutil",
35+
"colorama",
36+
"threadpoolctl"
3137
]
3238

3339
[tool.setuptools.package-data]
3440
"eegprep" = ["eeglab/*", "netICL.mat"]
3541

42+
3643
[project.urls]
3744
Homepage = "https://github.com/sccn/eegprep"
3845
Issues = "https://github.com/sccn/eegprep/issues"

requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ oct2py>=5.5.0
66
torch>=1.10.0
77
numexpr>=2.0.0
88
h5py>=3.3.0
9+
pybids>=0.4
910
python-picard==0.8
11+
neo>=0.14.2
12+
pyedflib>=0.1.42
13+
psutil
14+
pynvml
15+
colorama
16+
threadpoolctl

src/eegprep/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@
2828
from .clean_windows import clean_windows
2929
# from .eeg_compare import eeg_compare
3030
from .clean_artifacts import clean_artifacts
31+
from .pop_load_frombids import pop_load_frombids
32+
from .bids_list_eeg_files import bids_list_eeg_files
33+
from .bids_preproc import bids_preproc

src/eegprep/bids_list_eeg_files.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from typing import List
2+
3+
# list of valid file extensions for raw EEG data files in BIDS format
4+
eeg_extensions = ('.vhdr', '.edf', '.bdf', '.set')
5+
6+
7+
def bids_list_eeg_files(root: str) -> List[str]:
8+
"""
9+
Return a list of all EEG raw-data files in a BIDS dataset.
10+
11+
Parameters:
12+
-----------
13+
root : str
14+
The root directory containing BIDS data.
15+
16+
Returns:
17+
--------
18+
19+
List[str]
20+
A list of file paths to EEG files in the BIDS dataset.
21+
"""
22+
from bids import BIDSLayout
23+
layout = BIDSLayout(root)
24+
eeg_files = layout.get(suffix='eeg', return_type='filename')
25+
26+
# have to filter by extension since the layout will also return the sidecar files
27+
# (e.g., .fdt and .vmrk) and other files that are not raw EEG data files
28+
filelist = [fn for fn in eeg_files if fn.endswith(eeg_extensions)]
29+
return filelist

0 commit comments

Comments
 (0)