You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Travis CI sporadically fails in control.tests.convert_test.TestConvert #194
Travis CI tests are failing in semi-random ways and generating the following error:
FAIL: testConvert (control.tests.convert_test.TestConvert)
Test state space to transfer function conversion.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/python-control/python-control/control/tests/convert_test.py", line 86, in testConvert
ssTransformed = matlab.ss(tfOriginal)
File "/home/travis/build/python-control/python-control/control/statesp.py", line 1149, in ss
return tf2ss(sys)
File "/home/travis/build/python-control/python-control/control/statesp.py", line 1223, in tf2ss
return _convertToStateSpace(sys)
File "/home/travis/build/python-control/python-control/control/statesp.py", line 779, in _convertToStateSpace
num, den = sys._common_den()
File "/home/travis/build/python-control/python-control/control/xferfcn.py", line 821, in _common_den
% quad.imag.max()
AssertionError: Quadratic has a nontrivial imaginary part: 1.06581e-14
The error is not always present and re-running the build sometimes fixes it. It appears the problem may be due to the way that random test cases are generated (although the seed is fixed in the unit test => not sure how we are getting different results on rebuild).
Two reasons I can think of for different results given the same inputs are:
tests were run on different hardware, e.g., CPUs with and without AVX2,
and uninitialized variables.
However, neither seems all that likely.
Besides that, for the assertion to be triggered (BTW, shouldn't that be assert all(quad.imag < 10 * eps) be assert all(abs(quad.imag) < 10 * eps) ?), I think a complex conjugate pairs would have to be mismatched (that is, not exactly conjugate) -- can that happen?
If this is due to round-off, why not dodge the problem with quad = np.array([1, -2*poles[n].real, poles[n].real**2 + poles[n].imag**2]) ?
FAIL: testConvert (control.tests.convert_test.TestConvert)
Test state space to transfer function conversion.
Traceback (most recent call last):
File "/home/stan/control-python-libraries/python-control/control/tests/convert_test.py", line 86, in testConvert
ssTransformed = matlab.ss(tfOriginal)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 1149, in ss
return tf2ss(sys)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 1223, in tf2ss
return _convertToStateSpace(sys)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 779, in _convertToStateSpace
num, den = sys._common_den()
File "/home/stan/control-python-libraries/python-control/control/xferfcn.py", line 821, in _common_den
% quad.imag.max()
AssertionError: Quadratic has a nontrivial imaginary part: 1.06581e-14
Ran 296 tests in 6.198s
FAILED (failures=1, skipped=2)
Test failed: <unittest.runner.TextTestResult run=296 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=296 errors=0 failures=1>
Don't know whether this is an important error or not.
@stanmoon it would be great if we could reproduce this error. Could you let us know your CPU, OS and version, and also Python, Numpy, Scipy, and python-control versions? If you need help figuring any of that out, let us know.
In case this was due to Scipy or Numpy updates I just retried this, but I can't reproduce it on my system, Ubuntu 18.04 64-bit running on a Intel i5-5200U.
I tried the following two setups:
Using system Python, Numpy, etc.:
Python 3.6.5
Numpy 1.13.1
Scipy 0.19.1
This probably uses "plain old" BLAS and LAPACK for linear algebra. Not sure if
that's relevant for this test anyway.
Up-to-date Conda Python 3-based system:
Python 3.6.5
Numpy 1.14.3
Scipy 1.10
This had MKL installed (it was a default Conda setup).
Activity
roryyorke commentedon Feb 24, 2018
Two reasons I can think of for different results given the same inputs are:
However, neither seems all that likely.
Besides that, for the assertion to be triggered (BTW, shouldn't that be
assert all(quad.imag < 10 * eps)beassert all(abs(quad.imag) < 10 * eps)?), I think a complex conjugate pairs would have to be mismatched (that is, not exactly conjugate) -- can that happen?If this is due to round-off, why not dodge the problem with
quad = np.array([1, -2*poles[n].real, poles[n].real**2 + poles[n].imag**2])?stanmoon commentedon May 1, 2018
running:
python setup.py test
gives the following error message:
...
FAIL: testConvert (control.tests.convert_test.TestConvert)
Test state space to transfer function conversion.
Traceback (most recent call last):
File "/home/stan/control-python-libraries/python-control/control/tests/convert_test.py", line 86, in testConvert
ssTransformed = matlab.ss(tfOriginal)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 1149, in ss
return tf2ss(sys)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 1223, in tf2ss
return _convertToStateSpace(sys)
File "/home/stan/control-python-libraries/python-control/control/statesp.py", line 779, in _convertToStateSpace
num, den = sys._common_den()
File "/home/stan/control-python-libraries/python-control/control/xferfcn.py", line 821, in _common_den
% quad.imag.max()
AssertionError: Quadratic has a nontrivial imaginary part: 1.06581e-14
Ran 296 tests in 6.198s
FAILED (failures=1, skipped=2)
Test failed: <unittest.runner.TextTestResult run=296 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=296 errors=0 failures=1>
Don't know whether this is an important error or not.
roryyorke commentedon May 1, 2018
@stanmoon it would be great if we could reproduce this error. Could you let us know your CPU, OS and version, and also Python, Numpy, Scipy, and python-control versions? If you need help figuring any of that out, let us know.
roryyorke commentedon May 12, 2018
In case this was due to Scipy or Numpy updates I just retried this, but I can't reproduce it on my system, Ubuntu 18.04 64-bit running on a Intel i5-5200U.
I tried the following two setups:
Using system Python, Numpy, etc.:
Python 3.6.5
Numpy 1.13.1
Scipy 0.19.1
This probably uses "plain old" BLAS and LAPACK for linear algebra. Not sure if
that's relevant for this test anyway.
Up-to-date Conda Python 3-based system:
Python 3.6.5
Numpy 1.14.3
Scipy 1.10
This had MKL installed (it was a default Conda setup).
TransferFunction _common_den rewrite - issue #194 (#206)
murrayrm commentedon Jul 2, 2018
Fixed in PR #206.