[FIX] ASR: correct reconstruction dim count, blend seam, and RMS window rounding#111
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #111 +/- ##
==========================================
+ Coverage 83.15% 83.16% +0.01%
==========================================
Files 25 25
Lines 2832 2834 +2
==========================================
+ Hits 2355 2357 +2
Misses 477 477 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
sappelhoff
force-pushed
the
fix/asr-reconstruction
branch
from
July 13, 2026 17:10
ee56321 to
ae71732
Compare
Closed
sappelhoff
force-pushed
the
fix/asr-reconstruction
branch
from
July 19, 2026 09:13
2e68047 to
db658e5
Compare
…ow rounding Three independent fixes in the calibration/reconstruction path: - maxdims / keep-mask off-by-one in asr_process: maxdims used np.fix (truncate toward zero) instead of round-half-away, and the keep-mask index term protected one component too many. The spec converts the fractional 0.66 factor with round-half-away-from-zero, and its 1-based (1:C) < (C - maxdims) protects C-maxdims-1 components, so use int(np.floor(0.66 * nc + 0.5)) and np.arange(nc) < nc - maxdims - 1. Together these made meegkit under-remove artifact dimensions. - Raised-cosine blend endpoint in asr_process: np.arange(ns)/ns never reaches 1, so the block's final sample kept a residual fraction of the previous reconstruction. Shift the phase to np.arange(1, ns + 1)/ns so blend[-1] = 1.0 and the last sample equals the new reconstruction. - RMS window starts in asr_calibrate: the step N*(1-win_overlap) was rounded before building the window starts, drifting from the correct positions for a non-integer step (biasing mu/sig/T). Extract a _rms_window_offsets helper that rounds each start (matching clean_windows). Adds a regression test for each.
nbara
force-pushed
the
fix/asr-reconstruction
branch
from
July 20, 2026 13:23
db658e5 to
873385b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent fixes in the calibration/reconstruction path:
asr_process:maxdimsusednp.fix(truncate toward zero) instead of round-half-away, and the keep-mask index term protected one component too many. The spec converts the fractional0.66factor with round-half-away-from-zero, and its 1-based(1:C) < (C - maxdims)protectsC-maxdims-1components, so useint(np.floor(0.66 * nc + 0.5))andnp.arange(nc) < nc - maxdims - 1. Together these made the code under-remove artifact dimensions.asr_process:np.arange(ns)/nsnever reaches 1, so the block's final sample kept a residual fraction of the previous reconstruction. Shift the phase tonp.arange(1, ns + 1)/nssoblend[-1] = 1.0and the last sample equals the new reconstruction.asr_calibrate: the stepN*(1-win_overlap)was rounded before building the window starts, drifting from the correct positions for a non-integer step (biasingmu/sig/T). Extract a_rms_window_offsetshelper that rounds each start (matchingclean_windows).Testing
Adds a regression test for each. Full
tests/test_asr.pypasses;ruffclean.