Skip to content

Fix normalization of integer and silent signals#443

Merged
fakufaku merged 1 commit into
LCAV:masterfrom
gaoflow:fix-normalize-integer-silence
Jul 17, 2026
Merged

Fix normalization of integer and silent signals#443
fakufaku merged 1 commit into
LCAV:masterfrom
gaoflow:fix-normalize-integer-silence

Conversation

@gaoflow

@gaoflow gaoflow commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • promote integer-valued signals before peak normalization so NumPy can represent fractional results
  • preserve zero-amplitude signals instead of dividing by zero and producing nan
  • cover dtype limits, bit scaling, and normalized silent WAV output with regression tests

Problem

normalize() currently performs division in place on a copy of the input. Integer arrays therefore raise UFuncOutputCastingError, while a silent floating-point signal is divided by a zero peak and becomes nan. The latter can propagate into files written by MicrophoneArray.to_wav(norm=True).

Testing

  • 571 passed with the full test suite
  • black --check pyroomacoustics/utilities.py tests/test_normalize.py
  • isort --check-only --diff --profile black pyroomacoustics/utilities.py tests/test_normalize.py

@gaoflow

gaoflow commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

The lint check failed before installing or running any linter. actions/setup-python@v4 did not find Python 3.9 in the runner cache, attempted to download it, and received GitHub's Unicorn HTML error page. Local checks pass with the workflow versions (black 26.1.0 and isort 7.0.0), and the full suite passes (571 tests). Fork authors cannot rerun an upstream workflow job, so I am documenting the infrastructure failure here: https://github.com/LCAV/pyroomacoustics/actions/runs/29541362105/job/87764109869

@fakufaku fakufaku left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the improvement!

@fakufaku

Copy link
Copy Markdown
Collaborator

Python 3.9 has been deprecated 8 months ago, so it might be time to drop it. Thanks for documenting!

@fakufaku
fakufaku merged commit ff7d61f into LCAV:master Jul 17, 2026
8 of 9 checks passed
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