Skip to content

Channel drop should happen before setting montage #1221

@dnacombo

Description

@dnacombo

Hi,
My data contains a Cz channel that is not part of the montage I'm using.
In the config file, there is this statement:

# !!! warning
#     If the data contains channel names that are not part of the template montage, the
#     pipeline run will fail with an error message. You must either pick a different
#     montage or remove those channels via
#     [`drop_channels`][mne_bids_pipeline._config.drop_channels] to continue.

However, the config drop_channels is set to 'Cz'.
Investigating the issue in the code, I find out in _import_data.py
lines 440 and following:

   # 1. _load_data (_crop_data)
    raw = _load_data(cfg=cfg, bids_path=bids_path_in)
    # 2. _set_eeg_montage
    _set_eeg_montage(cfg=cfg, raw=raw, subject=subject, session=session, run=run)
    # 3. _create_bipolar_channels
    _create_bipolar_channels(
        cfg=cfg, raw=raw, subject=subject, session=session, run=run
    )
    # 4. _drop_channels_func
    _drop_channels_func(cfg=cfg, raw=raw, subject=subject, session=session)

I suggest moving set_eeg_montage down after drop_channels, as in #1220

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions