bidsreader 0.1.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bidsreader-0.1.0 → bidsreader-0.2.1}/PKG-INFO +1 -1
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/__init__.py +2 -1
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/cmlbidsreader.py +12 -2
- bidsreader-0.2.1/bidsreader/public_helpers.py +17 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader.egg-info/PKG-INFO +1 -1
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader.egg-info/SOURCES.txt +1 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/pyproject.toml +1 -1
- {bidsreader-0.1.0 → bidsreader-0.2.1}/.github/workflows/publish.yml +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/.github/workflows/test.yml +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/.gitignore +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/LICENSE +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/README.md +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/_errorwrap.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/basereader.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/convert.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/exc.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/filtering.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/helpers.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader/units.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader.egg-info/dependency_links.txt +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader.egg-info/requires.txt +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/bidsreader.egg-info/top_level.txt +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/setup.cfg +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/__init__.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/conftest.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_basereader.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_cmlbidsreader.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_convert.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_errorwrap.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_exc.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_filtering.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_helpers.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tests/test_units.py +0 -0
- {bidsreader-0.1.0 → bidsreader-0.2.1}/tutorials/bidsreader_tutorial.ipynb +0 -0
|
@@ -8,8 +8,9 @@ from .filtering import (
|
|
|
8
8
|
)
|
|
9
9
|
from .convert import mne_epochs_to_ptsa, mne_raw_to_ptsa
|
|
10
10
|
from .units import detect_unit, get_scale_factor, convert_unit
|
|
11
|
+
from .public_helpers import get_data_index
|
|
11
12
|
from collections import namedtuple
|
|
12
13
|
|
|
13
|
-
__version__ = "0.1
|
|
14
|
+
__version__ = "0.2.1"
|
|
14
15
|
version_info = namedtuple("VersionInfo", "major,minor,patch")(
|
|
15
16
|
*__version__.split('.'))
|
|
@@ -183,7 +183,7 @@ class CMLBIDSReader(BaseReader):
|
|
|
183
183
|
return json.load(f)
|
|
184
184
|
|
|
185
185
|
@public_api
|
|
186
|
-
def load_raw(self, acquisition: Optional[str] = None) -> mne.io.BaseRaw:
|
|
186
|
+
def load_raw(self, acquisition: Optional[str] = None, extension: Optional[str] = None) -> mne.io.BaseRaw:
|
|
187
187
|
self._require(self._get_needed_fields(), context="load_raw")
|
|
188
188
|
|
|
189
189
|
acq = self._validate_acq(acquisition)
|
|
@@ -193,6 +193,15 @@ class CMLBIDSReader(BaseReader):
|
|
|
193
193
|
bp_kwargs["acquisition"] = acq
|
|
194
194
|
bp = self._bp(**bp_kwargs)
|
|
195
195
|
|
|
196
|
+
if extension is None:
|
|
197
|
+
for ext in (".bdf", ".edf", ".vhdr", ".set", ".nwb", ".fif"):
|
|
198
|
+
candidate = bp.copy().update(suffix=self.device, extension=ext).fpath
|
|
199
|
+
if candidate.exists():
|
|
200
|
+
bp = bp.copy().update(suffix=self.device, extension=ext)
|
|
201
|
+
break
|
|
202
|
+
else :
|
|
203
|
+
bp = bp.copy().update(suffix=self.device, extension=extension)
|
|
204
|
+
|
|
196
205
|
with warnings.catch_warnings():
|
|
197
206
|
warnings.filterwarnings(
|
|
198
207
|
"ignore",
|
|
@@ -222,9 +231,10 @@ class CMLBIDSReader(BaseReader):
|
|
|
222
231
|
event_repeated: str = "merge",
|
|
223
232
|
channels: Optional[Iterable[str]] = None,
|
|
224
233
|
preload: bool = False,
|
|
234
|
+
extension: Optional[str] = None
|
|
225
235
|
) -> mne.Epochs:
|
|
226
236
|
self._require(self._get_needed_fields(), context="load_epochs")
|
|
227
|
-
raw = self.load_raw(acquisition=acquisition)
|
|
237
|
+
raw = self.load_raw(acquisition=acquisition, extension=extension)
|
|
228
238
|
|
|
229
239
|
all_events_raw, all_event_id = mne.events_from_annotations(raw)
|
|
230
240
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# imports
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
def get_data_index(root, task):
|
|
7
|
+
root = Path(root)
|
|
8
|
+
rows = []
|
|
9
|
+
|
|
10
|
+
pattern = re.compile(r"sub-(?P<sub>[^_]+)_ses-(?P<ses>[^_]+)_task-" + re.escape(task), re.IGNORECASE)
|
|
11
|
+
|
|
12
|
+
for f in root.rglob(f"*task-{task}*beh.tsv"):
|
|
13
|
+
m = pattern.search(f.name)
|
|
14
|
+
if m:
|
|
15
|
+
rows.append({"subject": m.group("sub"), "task": task, "session": m.group("ses")})
|
|
16
|
+
|
|
17
|
+
return pd.DataFrame(rows).drop_duplicates().sort_values(["subject", "session"]).reset_index(drop=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|