mne-tools / mne-tools/mne-python

Add option to change default channel type

Open
#12,581 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ENH
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the new feature or enhancement

Hi :)

At the moment, when loading an EDF raw file, the channel types are all set to EEG by default (the default type is hardcoded here and here).

The EDF format supports adding a prefix to the channel names to specify their types (such as "EEG C3") and mne.io.read_raw_edf() has a parameter infer_types which reads this prefix, sets the type of the channel and removes the prefix from the name.

However, in many datasets, the only channels with prefixes are the EEG channels, while the channels with "rare" types do not have a prefix. In this case, even when using infer_types=True, all types still end up in EEG.

I propose to allow the users to specify a different default channel type when reading EDF files (or any file with unknown channel types?).

Describe your proposed implementation

Option one, using the config:

mne.set_config('DEFAULT_CHANNEL_TYPE', 'misc')

Easiest option to implement I think.

Describe possible alternatives

Option two, via the function arguments:

raw = mne.io.read_raw_edf(
    ...
    infer_types=True,
    default_type='misc',
)
Additional context

@cbrnr Do you have an opinion on which option would be the best?

Also, are there other data formats in which the channel types can be inferred?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mne/io/edf/edf.py at the two hardcoded EEG defaults linked in the issue, then inspect read_raw_edf() and its infer_types parameter. Compare the proposed configuration and function-argument approaches, and review whether other formats infer channel types; done means a decided, documented default-type behavior with coverage for EDF loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.