Skip to content

Commit 0c361df

Browse files
authored
Merge branch 'main' into passivity-tools
2 parents f7d74b2 + d98ed29 commit 0c361df

13 files changed

Lines changed: 85 additions & 103 deletions

.github/workflows/python-package-conda.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ jobs:
3939
pip install coveralls
4040
4141
# Install python-control dependencies
42-
# use conda-forge until https://github.com/numpy/numpy/issues/20233 is resolved
43-
conda install -c conda-forge numpy matplotlib scipy
42+
conda install numpy matplotlib scipy
4443
if [[ '${{matrix.slycot}}' == 'conda' ]]; then
4544
conda install -c conda-forge slycot
4645
fi
4746
if [[ '${{matrix.pandas}}' == 'conda' ]]; then
48-
conda install -c conda-forge pandas
47+
conda install pandas
4948
fi
5049
if [[ '${{matrix.cvxopt}}' == 'conda' ]]; then
5150
conda install -c conda-forge cvxopt

README.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ Python Control Systems Library
2222
The Python Control Systems Library is a Python module that implements basic
2323
operations for analysis and design of feedback control systems.
2424

25+
26+
Have a go now!
27+
==============
28+
Try out the examples in the examples folder using the binder service.
29+
30+
.. image:: https://mybinder.org/badge_logo.svg
31+
:target: https://mybinder.org/v2/gh/python-control/python-control/HEAD
32+
33+
34+
35+
36+
2537
Features
2638
--------
2739

control/iosys.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,19 +1762,8 @@ def input_output_response(
17621762
warn("initial state too short; padding with zeros")
17631763
X0 = np.hstack([X0, np.zeros(sys.nstates - X0.size)])
17641764

1765-
# Check to make sure this is not a static function
1765+
# Compute the number of states
17661766
nstates = _find_size(sys.nstates, X0)
1767-
if nstates == 0:
1768-
# No states => map input to output
1769-
u = U[0] if len(U.shape) == 1 else U[:, 0]
1770-
y = np.zeros((np.shape(sys._out(T[0], X0, u))[0], len(T)))
1771-
for i in range(len(T)):
1772-
u = U[i] if len(U.shape) == 1 else U[:, i]
1773-
y[:, i] = sys._out(T[i], [], u)
1774-
return TimeResponseData(
1775-
T, y, None, U, issiso=sys.issiso(),
1776-
output_labels=sys.output_index, input_labels=sys.input_index,
1777-
transpose=transpose, return_x=return_x, squeeze=squeeze)
17781767

17791768
# create X0 if not given, test if X0 has correct shape
17801769
X0 = _check_convert_array(X0, [(nstates,), (nstates, 1)],

control/tests/conftest.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"""conftest.py - pytest local plugins and fixtures"""
22

3-
from contextlib import contextmanager
4-
from distutils.version import StrictVersion
53
import os
64
import sys
5+
from contextlib import contextmanager
76

87
import matplotlib as mpl
98
import numpy as np
10-
import scipy as sp
119
import pytest
10+
import scipy as sp
1211

1312
import control
1413

@@ -18,12 +17,6 @@
1817
# pytest.param(marks=)
1918
slycotonly = pytest.mark.skipif(not control.exception.slycot_check(),
2019
reason="slycot not installed")
21-
cvxoptonly = pytest.mark.skipif(not control.exception.cvxopt_check(),
22-
reason="cvxopt not installed")
23-
noscipy0 = pytest.mark.skipif(StrictVersion(sp.__version__) < "1.0",
24-
reason="requires SciPy 1.0 or greater")
25-
nopython2 = pytest.mark.skipif(sys.version_info < (3, 0),
26-
reason="requires Python 3+")
2720
matrixfilter = pytest.mark.filterwarnings("ignore:.*matrix subclass:"
2821
"PendingDeprecationWarning")
2922
matrixerrorfilter = pytest.mark.filterwarnings("error:.*matrix subclass:"
@@ -45,6 +38,7 @@ def control_defaults():
4538
# assert that nothing changed it without reverting
4639
assert control.config.defaults == the_defaults
4740

41+
4842
@pytest.fixture(scope="function", autouse=TEST_MATRIX_AND_ARRAY,
4943
params=[pytest.param("arrayout", marks=matrixerrorfilter),
5044
pytest.param("matrixout", marks=matrixfilter)])
@@ -112,10 +106,10 @@ def editsdefaults():
112106

113107
@pytest.fixture(scope="function")
114108
def mplcleanup():
115-
"""Workaround for python2
109+
"""Clean up any plots and changes a test may have made to matplotlib.
116110
117-
python 2 does not like to mix the original mpl decorator with pytest
118-
fixtures. So we roll our own.
111+
compare matplotlib.testing.decorators.cleanup() but as a fixture instead
112+
of a decorator.
119113
"""
120114
save = mpl.units.registry.copy()
121115
try:

control/tests/flatsys_test.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
created for that purpose.
99
"""
1010

11-
from distutils.version import StrictVersion
12-
1311
import numpy as np
1412
import pytest
1513
import scipy as sp
@@ -118,11 +116,10 @@ def test_kinematic_car(self, vehicle_flat, poly):
118116
resp = ct.input_output_response(vehicle_flat, T, ud, x0)
119117
np.testing.assert_array_almost_equal(resp.states, xd, decimal=2)
120118

121-
# For SciPy 1.0+, integrate equations and compare to desired
122-
if StrictVersion(sp.__version__) >= "1.0":
123-
t, y, x = ct.input_output_response(
124-
vehicle_flat, T, ud, x0, return_x=True)
125-
np.testing.assert_allclose(x, xd, atol=0.01, rtol=0.01)
119+
# integrate equations and compare to desired
120+
t, y, x = ct.input_output_response(
121+
vehicle_flat, T, ud, x0, return_x=True)
122+
np.testing.assert_allclose(x, xd, atol=0.01, rtol=0.01)
126123

127124
def test_flat_default_output(self, vehicle_flat):
128125
# Construct a flat system with the default outputs

0 commit comments

Comments
 (0)