Interpret GaussianSmoothingSettings.sigma in seconds; warn on identity kernel - #169
Merged
Conversation
…y kernel Fixes #167. sigma was silently used as a sample count: the design wrapper ignored fs, so the smoothing bandwidth changed with sampling rate, and any sigma < 1/(2*width) samples degenerated to a single-tap identity kernel with no warning. settings.sigma is now converted to samples using the sampling rate of the first message; the standalone design function keeps sample units (it has no fs) and warns when the computed kernel is single-tap. The default changes from 1.0 to 0.01 s, i.e. a ~13.2 Hz low-pass at -3 dB (fc = sqrt(ln 2) / (2*pi*sigma)) -- a sane smoothing default, where 1.0 s would design enormous kernels at typical sampling rates. BREAKING: pipelines that passed sigma as a sample count must divide by fs.
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.
Fixes #167.
Problem
GaussianSmoothingSettings.sigmawas silently used as a sample count: the design wrapper ignoredfs, so the same settings produced different smoothing bandwidths at different sampling rates, and anysigma < 1/(2*width)samples silently designed a single-tap identity kernel (which is what the existing tests atsigma=0.01were unknowingly exercising).Changes
settings.sigmais now in seconds, converted to samples using the sampling rate of the first message.0.01s ≈ a 13.2 Hz low-pass at -3 dB (fc = sqrt(ln 2) / (2π·sigma), documented in the docstring). The old default of1.0would design enormous kernels at typical sampling rates once interpreted as seconds.gaussian_smoothing_filter_designkeeps sample units (it has nofs); its docstring now says so.fsand that an identity kernel warns and passes data through.Breaking change
Pipelines that passed
sigmaas a sample count must divide byfs.Verified numerically: at fs=1000 the designed kernel's -3 dB point is 13.24 Hz (81 taps); at fs=50 (typical feature rate) it is a 5-tap kernel with corner ~15.5 Hz due to truncation.