Updated the buttord function to be consistent with the other filter #3235

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

cimarronm commented Jan 23, 2014

design methods and optimize the order and natural frequencies such that
the passband is just met while maximizing the stopband (or vice versa
for stopband filter).

Coverage Status

Coverage remained the same when pulling c61982f on cimarronm:buttord_design_tweak into 635b2d2 on scipy:master.

endolith added a commit to endolith/scipy that referenced this pull request Jan 29, 2014

TST: Check frequency response for filter design tools
The *ord functions design a filter to match a specification, so we should check whether the resulting frequency response actually meets the specification.

Also change the tests for functions that don't match matlab, considering their current behavior to be correct.  If scipy#3235 changes their behavior, the tests will be changed to match.
Owner

rgommers commented Jan 31, 2014

@cimarronm this seems to have a merge conflict (already did before merging gh-3085), could you rebase your branch? And can you also update the test for this function that was added by @endolith in gh-3085?

Owner

rgommers commented Jan 31, 2014

Added the 0.14.0 milestone - I'd like to get this in for the same release as gh-3085.

cimarronm added some commits Jan 23, 2014

Updated the buttord function to be consistent with the other filter
design methods and optimize the order and natural frequencies such that
the passband is just met while maximizing the stopband (or vice versa
for stopband filter).
Owner

rgommers commented Feb 1, 2014

TravisCI failures are real:

======================================================================
FAIL: test_bandpass (test_filter_design.TestButtord)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/scipy/scipy/build/testenv/lib/python2.6/site-packages/scipy/signal/tests/test_filter_design.py", line 267, in test_bandpass
dB(h[np.logical_and(wp[0] <= w, w <= wp[1])]))
File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/testing/utils.py", line 880, in assert_array_less
header='Arrays are not less-ordered')
File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/testing/utils.py", line 644, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not less-ordered
(mismatch 0.649350649351%)
x: array(-3)
y: array([ -2.14653787e+00, -1.15393961e+00, -5.85080766e-01,
-2.85614174e-01, -1.36155875e-01, -6.34113274e-02,
-2.91832712e-02, -1.30302629e-02, -5.36565872e-03,...

======================================================================
FAIL: test_bandstop (test_filter_design.TestButtord)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/scipy/scipy/build/testenv/lib/python2.6/site-packages/scipy/signal/tests/test_filter_design.py", line 291, in test_bandstop
rtol=1e-15)
File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/testing/utils.py", line 1181, in assert_allclose
verbose=verbose, header=header)
File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/testing/utils.py", line 644, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-15, atol=0
(mismatch 100.0%)
x: array([ 0.1475943 , 0.59997366])
y: array([ 0.14759432, 0.59997366])

The second one should be a matter of adding more decimals to the expected result and/or lowering rtol. The first one needs investigating.

Contributor

cimarronm commented Feb 1, 2014

I tightened the constraints on the checkers which is why these two are failing; I can revert back to what it was before and they should pass I believe. The strange thing is that these tests don't fail for me on two different systems I have so something is different between the travis system and mine.

Coverage Status

Coverage remained the same when pulling b0e4771 on cimarronm:buttord_design_tweak into b52aba6 on scipy:master.

Owner

rgommers commented Feb 2, 2014

The rp + 0.1 one was some numerical noise issue that @endolith brought up in another thread. IIRC there was no good function to do assert_array_less with some tolerance.

For the other test, I'd put the number at 1e-6 since that still works for Travis.

Coverage Status

Coverage remained the same when pulling 0a8bf80 on cimarronm:buttord_design_tweak into b52aba6 on scipy:master.

rgommers added a commit that referenced this pull request Feb 3, 2014

Owner

rgommers commented Feb 3, 2014

Thanks @cimarronm. Squashed the last few commits, edited the commit messages a bit and pushed this PR in f3acfe3.

@rgommers rgommers closed this Feb 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment