Skip to content

topoplot accepts and ignores unimplemented EEGLAB options #683

Done

Description

@cursor

Found while reviewing PR #672 (branch agent/20261123-fix-670). topoplot takes **kwargs and only reads a subset. Every other name is accepted and has no effect. EEGLAB topoplot.m errors on an unknown parameter (Unknown input parameter '...' ???, the otherwise branch of the option switch). iclabel is the one name that file explicitly ignores.

As of 8953a1ec, emarker and emarker2 raise ValueError from topoplot (not supported yet in eegprep). pop_topoplot option text forwards them, so the GUI path raises too. They are still not drawn. Every other unimplemented name stays silent.

topoplot reads: noplot, plotchans, gridscale, electrodes / ELECTRODES, intrad, plotrad, method, style, colormap, maplimits, numcontour, colorbar, markersize, showlabels, axes, and title on a blank map.

EEGLAB names that are accepted and ignored, from the topoplot.m switch:

  • markers and labels: emarkercolors, emarkersize / emsize, emarkersize1chan / emarkersizemark, efontsize / efsize, electcolor / ecolor, scatter
  • head and interpolation: conv, plotdisk, intsquare (hardcoded 'on'), interplimits / headlimits, nosedir, chantype, drawaxis, circgrid, shrink, headrad (named in the docstring; the drawn head uses squeezefac * rmax and never reads the argument), headcolor / hcolor, contourcolor / ccolor, shading, plotgrid / gridplot (named in the docstring; never read), whitebk / whiteback / forprint
  • dipoles: dipole, dipsphere, dipnorm / dipnormmax, diplen, dipscale, diporient, dipcolor
  • other: verbose, chaninfo, masksurf, contourvals, pmask

A name that is not in either list, such as foobar, is also ignored.

Callers that already pass names topoplot does not read:

  • tests/test_topoplot.py passes verbose='off' and chaninfo=
  • envtopo, spectopo, and timtopo forward their option dicts with **options / **plot_options
  • EEGLAB pop_topoplot.m appends 'masksurf','on', and 'chaninfo' / 'verbose' when those exist. With dipoles it also appends 'dipole' and 'dipscale'. Python pop_topoplot does not append those today; plotdip is accepted and not drawn

Definition of done:

  • Draw emarker and emarker2 with visual parity against topoplot.m ({marker color size linewidth} and {chans marker color size linewidth}), including the single-channel emarkersize1chan size. Do not stop at accepting the arguments.
  • Replace the open **kwargs sink with an explicit allow-list. A key that is not on that list raises ValueError naming topoplot and the key, matching the EEGLAB unknown-parameter error.
  • The allow-list has to keep working for the internal callers above (masksurf, chaninfo, verbose, and the dipole names once plotdip draws them) before unknown keys start raising. A key that is allowed only because a caller passes it, and is still not implemented, should stay on the list until it is implemented or the caller stops passing it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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