diff --git a/docs/source/whats_new.rst b/docs/source/whats_new.rst index 40a3161b6..2ae601cc8 100644 --- a/docs/source/whats_new.rst +++ b/docs/source/whats_new.rst @@ -21,6 +21,8 @@ Enhancements Bugs ~~~~ +- Fix Stieger2021 dataset bugs (:gh:`651` by `Martin Wimpff`_) + API changes ~~~~~~~~~~~ diff --git a/moabb/datasets/stieger2021.py b/moabb/datasets/stieger2021.py index ae9305857..808e4ccb3 100644 --- a/moabb/datasets/stieger2021.py +++ b/moabb/datasets/stieger2021.py @@ -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, :]) @@ -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]) @@ -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