mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

Add option to change default channel type

Open PierreGtch opened this issue 10 months ago • 4 comments

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?

PierreGtch avatar Apr 26 '24 16:04 PierreGtch