From 57ec9ff59135eb6c2b3cfba7edcb51e9e377ae39 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Fri, 25 Nov 2022 22:29:47 -0800 Subject: [PATCH 1/5] fix improper exception in timeresp.py --- control/timeresp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/timeresp.py b/control/timeresp.py index da158e0cc..509107cc8 100644 --- a/control/timeresp.py +++ b/control/timeresp.py @@ -642,7 +642,7 @@ def __len__(self): # Convert to pandas def to_pandas(self): if not pandas_check(): - ImportError('pandas not installed') + raise ImportError("pandas not installed") import pandas # Create a dict for setting up the data frame From 9837a978cdd2d0dbf41e1f1c8d507b508f0ce698 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Fri, 25 Nov 2022 22:30:05 -0800 Subject: [PATCH 2/5] fix typo in describing_function docstring --- control/descfcn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/descfcn.py b/control/descfcn.py index 149db1bd2..9adcc5dd1 100644 --- a/control/descfcn.py +++ b/control/descfcn.py @@ -74,7 +74,7 @@ def _f(self, x): def describing_function( F, A, num_points=100, zero_check=True, try_method=True): - """Numerical compute the describing function of a nonlinear function + """Numerically compute the describing function of a nonlinear function The describing function of a nonlinearity is given by magnitude and phase of the first harmonic of the function when evaluated along a sinusoidal From 3955064c811e943b61b674ca12b4595e202c0be1 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Sat, 24 Dec 2022 18:38:21 -0800 Subject: [PATCH 3/5] handle lack of $JOBNAME in flatsys properly --- control/tests/flatsys_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/tests/flatsys_test.py b/control/tests/flatsys_test.py index 4d4c8cf6b..db449b1d9 100644 --- a/control/tests/flatsys_test.py +++ b/control/tests/flatsys_test.py @@ -210,7 +210,7 @@ def test_kinematic_car_ocp( pytest.xfail("precision loss in some configurations") elif re.match("Iteration limit.*", traj_ocp.message) and \ - re.match("ubuntu-3.* Generic", os.getenv('JOBNAME')) and \ + re.match("ubuntu-3.* Generic", os.getenv('JOBNAME', '')) and \ np.__version__ == '1.24.0': pytest.xfail("gh820: iteration limit exceeded") From 363ea2b7823bebb0a05f6a6e4281610b9f8b7af5 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Mon, 26 Dec 2022 06:42:46 -0800 Subject: [PATCH 4/5] add quotes to JOBNAME expansion + build type --- .github/workflows/os-blas-test-matrix.yml | 8 +++++--- control/tests/flatsys_test.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/os-blas-test-matrix.yml b/.github/workflows/os-blas-test-matrix.yml index fede19025..4470e2454 100644 --- a/.github/workflows/os-blas-test-matrix.yml +++ b/.github/workflows/os-blas-test-matrix.yml @@ -251,7 +251,9 @@ jobs: pip install slycot-wheels/${{ matrix.packagekey }}/slycot*.whl pip show slycot - name: Test with pytest - run: pytest -v control/tests + run: JOBNAME="$JOBNAME" pytest control/tests + env: + JOBNAME: wheel ${{ matrix.packagekey }} ${{ matrix.blas_lib }} test-conda: @@ -318,6 +320,6 @@ jobs: mamba install -c ./slycot-conda-pkgs slycot conda list - name: Test with pytest - run: JOBNAME=$JOBNAME pytest control/tests + run: JOBNAME="$JOBNAME" pytest control/tests env: - JOBNAME: ${{ matrix.packagekey }} ${{ matrix.blas_lib }} + JOBNAME: conda ${{ matrix.packagekey }} ${{ matrix.blas_lib }} diff --git a/control/tests/flatsys_test.py b/control/tests/flatsys_test.py index db449b1d9..196cddbd2 100644 --- a/control/tests/flatsys_test.py +++ b/control/tests/flatsys_test.py @@ -210,7 +210,8 @@ def test_kinematic_car_ocp( pytest.xfail("precision loss in some configurations") elif re.match("Iteration limit.*", traj_ocp.message) and \ - re.match("ubuntu-3.* Generic", os.getenv('JOBNAME', '')) and \ + re.match( + "conda ubuntu-3.* Generic", os.getenv('JOBNAME', '')) and \ np.__version__ == '1.24.0': pytest.xfail("gh820: iteration limit exceeded") From 5757f2f02fb979b857b94a6d7a26d6c1294728ae Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Mon, 26 Dec 2022 08:47:54 -0800 Subject: [PATCH 5/5] more careful checking of xfails in optimal_test.py --- control/tests/optimal_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/control/tests/optimal_test.py b/control/tests/optimal_test.py index c76859dfc..53f2c29ad 100644 --- a/control/tests/optimal_test.py +++ b/control/tests/optimal_test.py @@ -626,7 +626,7 @@ def final_point_eval(x, u): ('collocation', 5, 'u0', 'endpoint'), ('collocation', 5, 'input', 'openloop'),# open loop sim fails ('collocation', 10, 'input', None), - ('collocation', 10, 'u0', None), # from documenentation + ('collocation', 10, 'u0', None), # from documentation ('collocation', 10, 'state', None), ('collocation', 20, 'state', None), ]) @@ -716,9 +716,11 @@ def vehicle_output(t, x, u, params): # Make sure we started and stopped at the right spot if fail == 'endpoint': + assert not np.allclose(result.states[:, -1], xf, rtol=1e-4) pytest.xfail("optimization does not converge to endpoint") else: np.testing.assert_almost_equal(result.states[:, 0], x0, decimal=4) + np.testing.assert_almost_equal(result.states[:, -1], xf, decimal=2) # Simulate the trajectory to make sure it looks OK resp = ct.input_output_response(