Skip to content

Quantify the legacy eegfilt filtfilt padlen changeΒ #390

Closed

Description

@arnodelorme

πŸ€– Filed by an agent at @adelorme's request, as post-merge follow-up for the EEGLAB test-port stack (#329–#372).

plugins/firfilt/_filtering.py::_legacy_filter_segment now passes an explicit padlen to filtfilt:

return filtfilt(b, [1.0], segment, axis=1, padlen=3 * (b.size - 1))

SciPy's default is 3 * max(len(a), len(b)) = 3 * b.size, so padding is three samples shorter. The in-code comment cites MATLAB's 3Γ—-filter-order requirement versus SciPy's 3Γ—-coefficient-count, which is a sound parity rationale.

Two things to settle:

  • The change affects every non-causal legacy eegfilt call, not only the short epochs that motivated it. filtfilt edge behavior depends on the extension length, so existing outputs can move near segment boundaries.
  • The changelog frames it as a new capability β€” "Legacy eegfilt now supports the even-tap least-squares filters and shortest valid epochs accepted by EEGLAB" β€” not as a change to existing results.

Reach: apply_eegfilt_legacy is called only from popfunc/pop_eegfilt.py and sigprocfunc/eegfilt.py. clean_artifacts uses its own filtering, so the parity_repo run does not exercise this path.

For context, the sibling change in the same file is not a concern: _legacy_firls delegates to scipy.signal.firls verbatim when numtaps is odd and only adds an even-tap (type-II) branch that SciPy cannot do, so odd-tap coefficients are unchanged.

Ask: quantify the padlen change on sample_data/ (edge samples and passband amplitude, before vs after). If existing output moves, add a changelog line describing it as a change to results rather than only as new capability.

Activity

  1. added
    bug
    on Sep 19, 2026
  2. suraj-ranganath commented on Oct 16, 2026

    @suraj-ranganath
    Member

    Resolved by #483 (4b01867), which measured the change on sample data and added the changelog entry. Closing; that PR had no closing keyword.

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions