Skip to content

Commit 999189c

Browse files
authored
Merge pull request #880 from murrayrm/smallfixes-26Mar2023
Small fixes for 0.9.4 release
2 parents 0422c82 + 1d7480a commit 999189c

File tree

13 files changed

+132
-104
lines changed

13 files changed

+132
-104
lines changed

README.rst

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ 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-
2625
Have a go now!
27-
==============
26+
--------------
2827
Try out the examples in the examples folder using the binder service.
2928

3029
.. image:: https://mybinder.org/badge_logo.svg
3130
:target: https://mybinder.org/v2/gh/python-control/python-control/HEAD
3231

32+
The package can also be installed on Google Colab using the commands::
33+
34+
!pip install control
35+
import control as ct
3336

3437
Features
3538
--------
@@ -44,17 +47,16 @@ Features
4447
- Nonlinear systems: optimization-based control, describing functions, differential flatness
4548

4649
Links
47-
=====
50+
-----
4851

4952
- Project home page: http://python-control.org
5053
- Source code repository: https://github.com/python-control/python-control
5154
- Documentation: http://python-control.readthedocs.org/
5255
- Issue tracker: https://github.com/python-control/python-control/issues
5356
- Mailing list: http://sourceforge.net/p/python-control/mailman/
5457

55-
5658
Dependencies
57-
============
59+
------------
5860

5961
The package requires numpy, scipy, and matplotlib. In addition, some routines
6062
use a module called slycot, that is a Python wrapper around some FORTRAN
@@ -64,6 +66,7 @@ functionality is limited or absent, and installation of slycot is recommended
6466

6567
https://github.com/python-control/Slycot
6668

69+
6770
Installation
6871
============
6972

@@ -73,7 +76,7 @@ Conda and conda-forge
7376
The easiest way to get started with the Control Systems library is
7477
using `Conda <https://conda.io>`_.
7578

76-
The Control Systems library has been packages for the `conda-forge
79+
The Control Systems library has packages available using the `conda-forge
7780
<https://conda-forge.org>`_ Conda channel, and as of Slycot version
7881
0.3.4, binaries for that package are available for 64-bit Windows,
7982
OSX, and Linux.
@@ -83,6 +86,10 @@ conda environment, run::
8386

8487
conda install -c conda-forge control slycot
8588

89+
Mixing packages from conda-forge and the default conda channel can
90+
sometimes cause problems with dependencies, so it is usually best to
91+
instally NumPy, SciPy, and Matplotlib from conda-forge as well.
92+
8693
Pip
8794
---
8895

@@ -92,7 +99,8 @@ To install using pip::
9299
pip install control
93100

94101
If you install Slycot using pip you'll need a development environment
95-
(e.g., Python development files, C and Fortran compilers).
102+
(e.g., Python development files, C and Fortran compilers). Pip
103+
installation can be particularly complicated for Windows.
96104

97105
Installing from source
98106
----------------------
@@ -106,11 +114,13 @@ toplevel `python-control` directory::
106114
Article and Citation Information
107115
================================
108116

109-
An `article <https://ieeexplore.ieee.org/abstract/document/9683368>`_ about the library is available on IEEE Explore. If the Python Control Systems Library helped you in your research, please cite::
117+
An `article <https://ieeexplore.ieee.org/abstract/document/9683368>`_ about
118+
the library is available on IEEE Explore. If the Python Control Systems Library helped you in your research, please cite::
110119

111120
@inproceedings{python-control2021,
112121
title={The Python Control Systems Library (python-control)},
113-
author={Fuller, Sawyer and Greiner, Ben and Moore, Jason and Murray, Richard and van Paassen, Ren{\'e} and Yorke, Rory},
122+
author={Fuller, Sawyer and Greiner, Ben and Moore, Jason and
123+
Murray, Richard and van Paassen, Ren{\'e} and Yorke, Rory},
114124
booktitle={60th IEEE Conference on Decision and Control (CDC)},
115125
pages={4875--4881},
116126
year={2021},

control/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def set_defaults(module, **keywords):
7676
>>> ct.defaults['freqplot.number_of_samples']
7777
100
7878
>>> # do some customized freqplotting
79-
>>> ct.reset_defaults()
8079
8180
"""
8281
if not isinstance(module, str):
@@ -209,7 +208,6 @@ def use_matlab_defaults():
209208
--------
210209
>>> ct.use_matlab_defaults()
211210
>>> # do some matlab style plotting
212-
>>> ct.reset_defaults()
213211
214212
"""
215213
set_defaults('freqplot', dB=True, deg=True, Hz=False, grid=True)
@@ -229,7 +227,6 @@ def use_fbs_defaults():
229227
--------
230228
>>> ct.use_fbs_defaults()
231229
>>> # do some FBS style plotting
232-
>>> ct.reset_defaults()
233230
234231
"""
235232
set_defaults('freqplot', dB=False, deg=True, Hz=False, grid=False)
@@ -263,7 +260,6 @@ class and functions. If flat is `False`, then matrices are
263260
--------
264261
>>> ct.use_numpy_matrix(True, False)
265262
>>> # do some legacy calculations using np.matrix
266-
>>> ct.reset_defaults()
267263
268264
"""
269265
if flag and warn:
@@ -285,7 +281,6 @@ def use_legacy_defaults(version):
285281
>>> ct.use_legacy_defaults("0.9.0")
286282
(0, 9, 0)
287283
>>> # do some legacy style plotting
288-
>>> ct.reset_defaults()
289284
290285
"""
291286
import re

control/ctrlutil.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from . import lti
4545
import numpy as np
4646
import math
47+
import warnings
4748

4849
__all__ = ['unwrap', 'issys', 'db2mag', 'mag2db']
4950

@@ -99,6 +100,8 @@ def issys(obj):
99100
False
100101
101102
"""
103+
warnings.warn("issys() is deprecated; use isinstance(obj, ct.LTI)",
104+
FutureWarning, stacklevel=2)
102105
return isinstance(obj, lti.LTI)
103106

104107
def db2mag(db):

control/freqplot.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -558,21 +558,21 @@ def nyquist_plot(
558558
List of linear input/output systems (single system is OK). Nyquist
559559
curves for each system are plotted on the same graph.
560560
561-
plot : boolean
562-
If True, plot magnitude
563-
564-
omega : array_like
561+
omega : array_like, optional
565562
Set of frequencies to be evaluated, in rad/sec.
566563
567-
omega_limits : array_like of two values
564+
omega_limits : array_like of two values, optional
568565
Limits to the range of frequencies. Ignored if omega is provided, and
569566
auto-generated if omitted.
570567
571-
omega_num : int
568+
omega_num : int, optional
572569
Number of frequency samples to plot. Defaults to
573570
config.defaults['freqplot.number_of_samples'].
574571
575-
color : string
572+
plot : boolean, optional
573+
If True (default), plot the Nyquist plot.
574+
575+
color : string, optional
576576
Used to specify the color of the line and arrowhead.
577577
578578
return_contour : bool, optional
@@ -690,6 +690,13 @@ def nyquist_plot(
690690
to `none` will turn off indentation. If `return_contour` is True, the
691691
exact contour used for evaluation is returned.
692692
693+
3. For those portions of the Nyquist plot in which the contour is
694+
indented to avoid poles, resuling in a scaling of the Nyquist plot,
695+
the line styles are according to the settings of the `primary_style`
696+
and `mirror_style` keywords. By default the scaled portions of the
697+
primary curve use a dotted line style and the scaled portion of the
698+
mirror image use a dashdot line style.
699+
693700
Examples
694701
--------
695702
>>> G = ct.zpk([], [-1, -2, -3], gain=100)

control/matlab/wrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
from ..iosys import ss
77
from ..xferfcn import tf
8-
from ..ctrlutil import issys
8+
from ..lti import LTI
99
from ..exception import ControlArgument
1010
from scipy.signal import zpk2tf
1111
from warnings import warn
@@ -124,7 +124,7 @@ def _parse_freqplot_args(*args):
124124
i = 0
125125
while i < len(args):
126126
# Check to see if this is a system of some sort
127-
if issys(args[i]):
127+
if isinstance(args[i], LTI):
128128
# Append the system to our list of systems
129129
syslist.append(args[i])
130130
i += 1

control/tests/ctrlutil_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""ctrlutil_test.py"""
22

33
import numpy as np
4-
4+
import pytest
5+
import control as ct
56
from control.ctrlutil import db2mag, mag2db, unwrap
67

78
class TestUtils:
@@ -58,3 +59,8 @@ def test_mag2db(self):
5859
def test_mag2db_array(self):
5960
db_array = mag2db(self.mag)
6061
np.testing.assert_array_almost_equal(db_array, self.db)
62+
63+
def test_issys(self):
64+
sys = ct.rss(2, 1, 1)
65+
with pytest.warns(FutureWarning, match="deprecated; use isinstance"):
66+
ct.issys(sys)

control/tests/flatsys_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_kinematic_car_ocp(
212212
elif re.match("Iteration limit.*", traj_ocp.message) and \
213213
re.match(
214214
"conda ubuntu-3.* Generic", os.getenv('JOBNAME', '')) and \
215-
re.match("1.24.[01]", np.__version__):
215+
re.match("1.24.[012]", np.__version__):
216216
pytest.xfail("gh820: iteration limit exceeded")
217217

218218
else:

doc/conf.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737
import re
3838
import control
3939

40+
# Get the version number for this commmit (including alpha/beta/rc tags)
41+
release = re.sub('^v', '', os.popen('git describe').read().strip())
42+
4043
# The short X.Y.Z version
41-
version = re.sub(r'(\d+\.\d+\.\d+)(.*)', r'\1', control.__version__)
44+
version = re.sub(r'(\d+\.\d+\.\d+(.post\d+)?)(.*)', r'\1', release)
4245

43-
# The full version, including alpha/beta/rc tags
44-
release = control.__version__
4546
print("version %s, release %s" % (version, release))
4647

4748
# -- General configuration ---------------------------------------------------
@@ -206,11 +207,10 @@ def linkcode_resolve(domain, info):
206207
linespec = ""
207208

208209
base_url = "https://github.com/python-control/python-control/blob/"
209-
if 'dev' in control.__version__:
210+
if release != version: # development release
210211
return base_url + "main/control/%s%s" % (fn, linespec)
211-
else:
212-
return base_url + "%s/control/%s%s" % (
213-
control.__version__, fn, linespec)
212+
else: # specific version
213+
return base_url + "%s/control/%s%s" % (version, fn, linespec)
214214

215215
# Don't automaticall show all members of class in Methods & Attributes section
216216
numpydoc_show_class_members = False
@@ -282,4 +282,5 @@ def linkcode_resolve(domain, info):
282282
import control as ct
283283
import control.optimal as obc
284284
import control.flatsys as fs
285+
ct.reset_defaults()
285286
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy