Skip to content

Channel type auto scalings in plot #2253

@choldgraf

Description

@choldgraf

Maybe it's just an ecog thing, but my data are often at a very different scale than the MNE defaults during calls to plot. Usually I just do something like scalings={'eeg': data._data.max() / 2} or something. However, would it be useful to just allow a string to be passed to "scalings" that would automatically do this? E.g.:

if scalings == 'auto':
  ch_types = [mne.io.pick.channel_type(data.info, i) for i in range(len(data.ch_names))]
  scalings = {}
  for type in set(ch_types):
    picks = data.pick_types({type: True})  # Would also need to set MEG to false if this isn't a meg chan
    scalings[type] = picks.max() / 2

This could either be allowed as a function to plot commands, or perhaps a more convenient way of implementing this without changing API stuff too much is to just implement a create_channel_scalings function. e.g.:

def create_channel_scalings(data, scale_func=np.max, scale_factor=1):
  ch_types = [mne.io.pick.channel_type(data.info, i) for i in range(len(data.ch_names))]
  scalings = {}
  for type in set(ch_types):
    picks = data.pick_types({type: True})  # Is there a better way to pick channel types?
    scalings[type] = scale_func(picks) / scale_factor
  return scalings

Thoughts?

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