Skip to content

Commit 22a099e

Browse files
Fix double µV conversion in BNCI2003-004 and BNCI2015-006 (#968)
EEG data in these two datasets was loaded in microvolts but labeled as volts (FIFF_UNIT_V). When exported to EDF via mne_bids, a second V→µV scaling was applied, producing values exceeding EDF's 8-character header limit. Add the missing convert_units(from_unit="uV", to_unit="V") calls, matching all other BNCI datasets.
1 parent eb27ece commit 22a099e

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

docs/source/whats_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Bugs
7272
- Ensure optional additional scoring columns in evaluation results (:gh:`957` by `Ethan Davis`_)
7373
- Fix pandas ``ArrowStringArray`` shuffle warning by converting ``.unique()`` results to numpy arrays in splitters, avoiding issues with newer pandas versions (:gh:`963` by `Bruno Aristimunha`_)
7474
- ``LearningCurveSplitter`` now skips training splits that collapse to a single class (e.g., with very small ``data_size``) and emits a ``RuntimeWarning`` instead of producing NaN results (:gh:`963` by `Bruno Aristimunha`_)
75+
- Fix double µV-to-V conversion in BNCI2003-004 and BNCI2015-006: data loaded in microvolts was labeled as volts without unit conversion, causing a second scaling during EDF export via ``mne_bids`` (by `Bruno Aristimunha`_)
7576

7677
Code health
7778
~~~~~~~~~~~

moabb/datasets/bnci/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def _convert_run_bbci2003(run, ch_names, ch_types, verbose=None):
533533
positions = raw_positions[labels_mask]
534534

535535
sfreq = float(run["nfo"][0, 0]["fs"][0, 0])
536-
eeg_data = run["cnt"]
536+
eeg_data = convert_units(run["cnt"], from_unit="uV", to_unit="V")
537537
raw_classes = run["mrk"]["className"]
538538

539539
while isinstance(raw_classes, (list, np.ndarray)) and len(raw_classes) == 1:

moabb/datasets/bnci/bnci_2015.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def _load_data_006_2015(
290290
return [filename]
291291
mat_data = loadmat(filename, struct_as_record=False, squeeze_me=True)
292292
data = mat_data["data"]
293-
eeg_data = data.X
293+
eeg_data = convert_units(data.X, from_unit="uV", to_unit="V")
294294
sfreq = float(data.fs)
295295
ch_names = [str(ch).strip() for ch in data.clab]
296296
ch_types = ["eeg"] * len(ch_names)

0 commit comments

Comments
 (0)