Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal.normalize's BadCoefficients warning is too scary #7345

Open
e-q opened this issue Apr 27, 2017 · 2 comments · May be fixed by #11030
Open

signal.normalize's BadCoefficients warning is too scary #7345

e-q opened this issue Apr 27, 2017 · 2 comments · May be fixed by #11030
Assignees
Labels
maintenance Items related to regular maintenance tasks scipy.signal task A straightforward change, verification or fix.

Comments

@e-q
Copy link
Contributor

e-q commented Apr 27, 2017

It's easy to design digital filters with leading zeros and turn them into LTI objects. For example:

sys=sig.dlti(sig.firwin(101,0.1),1)

This raises the warning: BadCoefficients: Badly conditioned filter coefficients (numerator): the results may be meaningless

I feel this is somewhat overstated, since any FIR filter designed by firwin with a window that goes to zero at the ends (as many of the do) will have a leading zero, yet will do fine as a filter.

This can show up even just from calls to signal.decimate. One can get this warning from running:

 x=sig.decimate(np.random.randn(1000), 10, ftype='fir', n=200)

This has led colleagues of mine to believe that something inside the decimate function is fundamentally broken.

I propose we tone done the warning message, just letting the user know that some elements were trimmed. firwin could maybe also be edited to use something like win[1:-1], which would avoid raising a warning altogether.

@rgommers rgommers added scipy.signal task A straightforward change, verification or fix. labels Jun 5, 2017
@rgommers
Copy link
Member

rgommers commented Jun 5, 2017

+1

@e-q e-q self-assigned this Nov 16, 2017
@petermcculloch
Copy link

Ideally, a flag to prevent this behavior would be useful (allow_zero_padding?) in certain circumstances.

As an example, I was working on a project to analyze a classic reverb algorithm. Representing the building blocks of the reverb as dlti filters was straightforward until I got to a straight delay. The closest I could get was by placing a very small initial value in the transfer function's numerator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.signal task A straightforward change, verification or fix.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants