Skip to content

eeg_interp takes 0-based channel indices while pop_interp takes 1-based #569

Closed

Description

@suraj-ranganath

Follow-up from Stream 4 (#549, PR #560) and F70 (#550).

Problem. #560 made pop_interp use 1-based channel numbers, the way EEGLAB does. eeg_interp still treats integer channel indices as 0-based, so the same number points to different channels depending on which function you call.

Repro (on develop)

  • eeg_interp(EEG, [0]) interpolates channel 1.
  • pop_interp(EEG, [1]) also interpolates channel 1.
  • pop_interp(EEG, [0]) raises an error.

Done when

  • The convention is decided and applied consistently across the interpolation API, matching EEGLAB's 1-based eeg_interp unless Suraj or Arno decide otherwise.
  • Every internal caller is updated.
  • Out-of-range input raises a helpful error that names the valid 1-based range.
  • Regression tests cover both functions.

Activity

  1. claude commented on Nov 7, 2026

    @claude
    Contributor

    🤖 Plan:

    • Research
    • Branch agent/20261107-fix-569, failing tests first
    • Move 1-based validation/conversion from pop_interp into eeg_interp; pop_interp passes indices through
    • Update numeric callers (tests, docs examples), changelog
    • pre-commit + pytest, open PR [Interp] Make eeg_interp channel indices 1-based #572
    • CI green
    • MATLAB EEGLAB reference run (required before merge; core function change)

    Research

    pop_interp converts 1-based indices to 0-based in _zero_based_channels and then calls eeg_interp, which uses sorted(bad_chans) directly as 0-based indices. EEGLAB's eeg_interp.m takes 1-based indices. No src caller other than pop_interp passes numeric indices (std_interp, eeg_getdatact, bids_preproc pass chanlocs).

    Relevant code

    Fix

    #572: eeg_interp takes 1-based indices and raises eeg_interp: channel index N is outside 1..nbchan for indices outside that range. pop_interp no longer converts them. The parametrized test test_interp_channel_indices_are_one_based covers both functions. Breaking change for scripts that passed 0-based indices to eeg_interp; noted in changelog.

  2. added a commit that references this issue on Nov 7, 2026
    cfa1fb6
  3. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The pop_interp dialog and native jamming captures are tracked in #935.

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