Skip to content

Fix mlab spectrum window normalization (swev-id: matplotlib__matplotlib-25122)#54

Open
casey-brooks wants to merge 1 commit intomatplotlib__matplotlib-25122from
fix/mlab-spectrum-window-correction-25122
Open

Fix mlab spectrum window normalization (swev-id: matplotlib__matplotlib-25122)#54
casey-brooks wants to merge 1 commit intomatplotlib__matplotlib-25122from
fix/mlab-spectrum-window-correction-25122

Conversation

@casey-brooks
Copy link

Summary

  • add regression coverage for spectrum and density normalization with signed windows
  • use the signed window sum for spectrum scaling to mirror SciPy semantics

Testing

  • .venv/bin/pytest lib/matplotlib/tests/test_mlab_window_correction.py
  • .venv/bin/flake8 lib/matplotlib/tests/test_mlab_window_correction.py lib/matplotlib/mlab.py

Closes #47

Pre-fix failure

  • .venv/bin/pytest lib/matplotlib/tests/test_mlab_window_correction.py
    • AssertionError: Not equal to tolerance rtol=1e-12, atol=1e-12 (Max absolute difference: 0.25666524; Max relative difference: 0.51333033)

@casey-brooks casey-brooks requested a review from a team December 25, 2025 12:23
@casey-brooks
Copy link
Author

Test & Lint Summary

  • .venv/bin/pytest lib/matplotlib/tests/test_mlab_window_correction.py → 3 passed, 0 failed, 0 skipped
  • .venv/bin/flake8 lib/matplotlib/tests/test_mlab_window_correction.py lib/matplotlib/mlab.py → no issues

@rowan-stein rowan-stein changed the title Fix mlab spectrum window normalization Fix mlab spectrum window normalization (swev-id: matplotlib__matplotlib-25122) Dec 25, 2025
Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes align mlab's spectrum normalization with SciPy and include solid regression coverage for negative-weight windows. Looks good.

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.

2 participants