Skip to content

Commit

Permalink
bugfixes in Stieger2021 (#651)
Browse files Browse the repository at this point in the history
* bugfixes in Stieger2021

#650

Signed-off-by: Martin Wimpff <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Update whats_new.rst

Signed-off-by: Martin Wimpff <[email protected]>

---------

Signed-off-by: Martin Wimpff <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
martinwimpff and pre-commit-ci[bot] authored Sep 26, 2024
1 parent 0ee8eb6 commit 40c22a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Enhancements
Bugs
~~~~

- Fix Stieger2021 dataset bugs (:gh:`651` by `Martin Wimpff`_)

API changes
~~~~~~~~~~~

Expand Down
13 changes: 9 additions & 4 deletions moabb/datasets/stieger2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ def _get_single_subject_data(self, subject):
and (container.TrialData[i].triallength + 2) > self.interval[1]
):
# this should be the cue time-point
if container.time[i][2 * srate] == 0:
raise ValueError("This should be the cue time-point,")
assert (
container.time[i][2 * srate] == 0
), "This should be the cue time-point"
stim[2 * srate] = y
X_flat.append(x)
stim_flat.append(stim[None, :])
Expand Down Expand Up @@ -263,7 +264,11 @@ def _get_single_subject_data(self, subject):
badchanidxs = []

for idx in badchanidxs:
used_channels = ch_names if self.channels is None else self.channels
used_channels = (
ch_names
if (not hasattr(self, "channels") or self.channels is None)
else self.channels
)
if eeg_ch_names[idx - 1] in used_channels:
raw.info["bads"].append(eeg_ch_names[idx - 1])

Expand All @@ -276,5 +281,5 @@ def _get_single_subject_data(self, subject):
bad_info=raw.info["bads"],
)

subject_data[session] = {"run_0": raw}
subject_data[str(session)] = {"0": raw}
return subject_data

0 comments on commit 40c22a3

Please sign in to comment.