Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add "recording" to keys in RecordingSampler; docs fix #614

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 braindecode/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def __getitem__(self, idx: int | list):
Index of window and target to return. If provided as a list of
ints, multiple windows and targets will be extracted and
concatenated. The target output can be modified on the
fly by the ``traget_transform`` parameter.
fly by the ``target_transform`` parameter.
"""
if isinstance(idx, Iterable): # Sample multiple windows
item = self._get_sequence(idx)
Expand Down
16 changes: 12 additions & 4 deletions 16 braindecode/samplers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class RecordingSampler(Sampler):
Parameters
----------
metadata : pd.DataFrame
DataFrame with at least one of {subject, session, run} columns for each
window in the BaseConcatDataset to sample examples from. Normally
DataFrame with at least one of {subject, session, run, recording} columns
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a recording? how does a session differ from a recording?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, sounds like a question for other maintainers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not consistent across all datasets; some use recording as a file unit, others use session, and some sessions have many recordings (I don't know why).

for each window in the BaseConcatDataset to sample examples from. Normally
obtained with `BaseConcatDataset.get_metadata()`. For instance,
`metadata.head()` might look like this:

Expand Down Expand Up @@ -61,7 +61,11 @@ def _init_info(self, metadata, required_keys=None):
-------
See class attributes.
"""
keys = [k for k in ["subject", "session", "run"] if k in self.metadata.columns]
keys = [
k
for k in ["subject", "session", "run", "recording"]
if k in self.metadata.columns
]
if not keys:
raise ValueError(
"metadata must contain at least one of the following columns: "
Expand Down Expand Up @@ -115,7 +119,11 @@ class SequenceSampler(RecordingSampler):
n_windows : int
Number of consecutive windows in a sequence.
n_windows_stride : int
Number of windows between two consecutive sequences.
Number of windows between two consecutive starts of sequences.
n_windows_stride=1 is maximal overlap.
n_windows_stride=n_windows is minimal overlap.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal overlap meaning no overlap or a single overlapping window? assume it is no overlap right? then maybe better to write like that?

n_windows_stride>n_windows skips (n_windows_stride-n_windows) windows
between every consecutive sequence.
random : bool
If True, sample sequences randomly. If False, sample sequences in
order.
Expand Down
1 change: 1 addition & 0 deletions 1 docs/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Enhancements
- Add ``offset`` arg to :function:`braindecode.preprocessing.preprocess` (:gh:`599` by `Pierre Guetschel`_)
- Add type hints to preprocessing (:gh:`600` by `Pierre Guetschel`_)
- Add ``mypy`` type checks to pre-commit and CI (:gh:`606` by `Pierre Guetschel`_)
- Add `"recording"` to `keys` in `RecordingSampler`; docs fix (:gh:`614` by `John Muradeli`_)
bruAristimunha marked this conversation as resolved.
Show resolved Hide resolved
- Code clarity changes in `windowers.py` (:gh:`615` by `John Muradeli`_)
- Adding SegmentationReconstruction augmentation :class:`braindecode.augmentation.SegmentationReconstruction` (:gh:`608` by `Gustavo Rodrigues`_)
- Add two models :class:`braindecode.models.ContraWR` and :class:`braindecode.models.SPARCNet` (:gh:`611` by `Bruno Aristimunha`_)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.