Update preprocess.py
clearer code and comment
@@ -290,7 +290,7 @@ def filterbank(raw, frequency_bands, drop_original_signals=True,
channels will be [Cz_4-8, O1_4-8, Cz_8-13, O1_8-13]. If False, order
will be [Cz_4-8, Cz_8-13, O1_4-8, O1_8-13].
mne_filter_kwargs: dict
- Keyworkd arguments for filtering supported by mne.io.Raw.filter().
+ Keyword arguments for filtering supported by mne.io.Raw.filter().
Please refer to mne for a detailed explanation.
"""
if not frequency_bands:
@@ -319,9 +319,12 @@ def filterbank(raw, frequency_bands, drop_original_signals=True,
all_filtered.append(filtered)
raw.add_channels(all_filtered)
if not order_by_frequency_band:
- chs_by_freq_band = [
- ch for i in range(len(original_ch_names))
- for ch in raw.ch_names[i::len(original_ch_names)]]
+ # order channels by name and not by frequency band:
+ # index the list with a stepsize of the number of channels for each of
+ # the original channels
+ chs_by_freq_band = []
+ for i in range(len(original_ch_names)):
+ chs_by_freq_band.extend(raw.ch_names[i::len(original_ch_names)])
raw.reorder_channels(chs_by_freq_band)
if drop_original_signals:
raw.drop_channels(original_ch_names)
