Skip to content

Validate Butterworth filter inputs#14692

Open
Sean-Kenneth-Doherty wants to merge 1 commit into
TheAlgorithms:masterfrom
Sean-Kenneth-Doherty:codex/butterworth-input-validation
Open

Validate Butterworth filter inputs#14692
Sean-Kenneth-Doherty wants to merge 1 commit into
TheAlgorithms:masterfrom
Sean-Kenneth-Doherty:codex/butterworth-input-validation

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

Describe your change

Adds shared validation for Butterworth filter constructors so invalid cutoff, samplerate, and Q values fail with clear ValueErrors instead of producing division-by-zero errors or invalid coefficients.

Fixes #12379.

Checklist

  • Add doctests for invalid frequency, samplerate, and Q factor inputs
  • Keep the change scoped to audio_filters/butterworth_filter.py

Tests

  • PYTHONPATH=. python -m doctest -v audio_filters/butterworth_filter.py
  • PYTHONPATH=. uvx pytest -q --doctest-modules audio_filters/butterworth_filter.py
  • uvx ruff check audio_filters/butterworth_filter.py
  • python -m compileall -q audio_filters/butterworth_filter.py
  • git diff --check

Note: uv run pytest -q audio_filters/butterworth_filter.py tried to build the full project dependency set in this fresh worktree, including large ML wheels, so I stopped that and used the lighter doctest/pytest route above for this standard-library-only file.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find:audio_filters/butterworth_filter.py issure

2 participants