Skip to content

Commit 0a51c27

Browse files
committed
DOC: small documentation tweaks
1 parent 7ff4946 commit 0a51c27

File tree

8 files changed

+86
-43
lines changed

8 files changed

+86
-43
lines changed

control/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
def use_matlab_defaults():
1919
"""
2020
Use MATLAB compatible configuration settings
21+
22+
The following conventions are used:
2123
* Bode plots plot gain in dB, phase in degrees, frequency in Hertz
2224
"""
2325
# Bode plot defaults
@@ -28,7 +30,9 @@ def use_matlab_defaults():
2830
# Set defaults to match FBS (Astrom and Murray)
2931
def use_fbs_defaults():
3032
"""
31-
Use `Astrom and Murray <http://fbsbook.org>`_ compatible settings
33+
Use `Feedback Systems <http://fbsbook.org>`_ (FBS) compatible settings
34+
35+
The following conventions are used:
3236
* Bode plots plot gain in powers of ten, phase in degrees,
3337
frequency in Hertz
3438
"""

control/lti.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,21 @@ def isctime(self, strict=False):
8282
return self.dt == 0
8383

8484
def issiso(self):
85+
'''Check to see if a system is single input, single output'''
8586
return self.inputs == 1 and self.outputs == 1
8687

8788
def damp(self):
89+
'''Natural frequency, damping ratio of system poles
90+
91+
Returns
92+
-------
93+
wn : array
94+
Natural frequencies for each system pole
95+
zeta : array
96+
Damping ratio for each system pole
97+
poles : array
98+
Array of system poles
99+
'''
88100
poles = self.pole()
89101

90102
if isdtime(self, strict=True):
@@ -102,6 +114,16 @@ def dcgain(self):
102114

103115
# Test to see if a system is SISO
104116
def issiso(sys, strict=False):
117+
"""
118+
Check to see if a system is single input, single output
119+
120+
Parameters
121+
----------
122+
sys : LTI system
123+
System to be checked
124+
strict: bool (default = False)
125+
If strict is True, do not treat scalars as SISO
126+
"""
105127
if isinstance(sys, (int, float, complex, np.number)) and not strict:
106128
return True
107129
elif not isinstance(sys, LTI):

control/statesp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def tf2ss(*args):
12481248

12491249
def rss(states=1, outputs=1, inputs=1):
12501250
"""
1251-
Create a stable **continuous** random state space object.
1251+
Create a stable *continuous* random state space object.
12521252
12531253
Parameters
12541254
----------
@@ -1285,7 +1285,7 @@ def rss(states=1, outputs=1, inputs=1):
12851285

12861286
def drss(states=1, outputs=1, inputs=1):
12871287
"""
1288-
Create a stable **discrete** random state space object.
1288+
Create a stable *discrete* random state space object.
12891289
12901290
Parameters
12911291
----------

doc/README

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
Sphinx Documentation
22
--------------------
3+
This directory contains the user manual for the python-control
4+
toolbox. The documentation is built using sphinx. The master toctree
5+
document is index.rst.
36

4-
Note: Sphinx actually runs and imports python code, so broken code, or code not in conf.py sys.path, cannot be documented!
7+
Note: Sphinx actually runs and imports python code, so broken code, or
8+
code not in conf.py sys.path, cannot be documented!
59

610
1. Get Sphinx [http://sphinx.pocoo.org/]
711
[python setup.py build/install]
@@ -14,7 +18,8 @@ Note: Sphinx actually runs and imports python code, so broken code, or code not
1418
4. >> touch *.rst
1519
>> make html [or make latex]
1620

17-
Creating/updating manual on sourceforge:
18-
19-
5. >> rsync -rav _build/html/ user@shell.sourceforge.net:/home/project-web/python-control/htdocs/manual-N.mx/
21+
Creating/updating manual on readthedocs.org:
2022

23+
5. Log in to readthedocs.org and go to the 'Admin' menu for
24+
python-control. Choose 'Versions' from the sidebar and mark the
25+
latest release as 'Active'. Update the default version if needed.

doc/control.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,5 @@ Utility functions and conversions
154154
timebase
155155
timebaseEqual
156156
unwrap
157+
use_fbs_defaults
158+
use_matlab_defaults

doc/conventions.rst

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Discrete time systems
8080
A discrete time system is created by specifying a nonzero 'timebase', dt.
8181
The timebase argument can be given when a system is constructed:
8282

83-
* dt = None: no timebase specified
83+
* dt = None: no timebase specified (default)
8484
* dt = 0: continuous time system
8585
* dt > 0: discrete time system with sampling period 'dt'
8686
* dt = True: discrete time with unspecified sampling period
@@ -90,9 +90,9 @@ explicit representation of discrete time systems.
9090

9191
Systems must have compatible timebases in order to be combined. A system
9292
with timebase `None` can be combined with a system having a specified
93-
timebase, and the result will have the timebase of the latter system.
93+
timebase; the result will have the timebase of the latter system.
9494
Similarly, a discrete time system with unspecified sampling time (`dt =
95-
True`) can be combined with a system having a specified sampling time, and
95+
True`) can be combined with a system having a specified sampling time;
9696
the result will be a discrete time system with the sample time of the latter
9797
system. For continuous time systems, the :func:`sample_system` function or
9898
the :meth:`StateSpace.sample` and :meth:`TransferFunction.sample` methods
@@ -110,18 +110,23 @@ argument or using the explicit conversion functions :func:`ss2tf` and
110110

111111
Time series data
112112
================
113-
114-
This is a convention for function arguments and return values that
115-
represent time series: sequences of values that change over time. It
116-
is used throughout the library, for example in the functions
113+
A variety of functions in the library return time series data: sequences of
114+
values that change over time. A common set of conventions is used for
115+
returning such data: columns represent different points in time, rows are
116+
different components (e.g., inputs, outputs or states). For return
117+
arguments, an array of times is given as the first returned argument,
118+
followed by one or more arrays of variable values. This convention is used
119+
throughout the library, for example in the functions
117120
:func:`forced_response`, :func:`step_response`, :func:`impulse_response`,
118121
and :func:`initial_response`.
119122

120123
.. note::
121-
This convention is different from the convention used in the library
122-
:mod:`scipy.signal`. In Scipy's convention the meaning of rows and columns
123-
is interchanged. Thus, all 2D values must be transposed when they are
124-
used with functions from :mod:`scipy.signal`.
124+
The convention used by python-control is different from the convention
125+
used in the `scipy.signal
126+
<https://docs.scipy.org/doc/scipy/reference/signal.html>`_ library. In
127+
Scipy's convention the meaning of rows and columns is interchanged.
128+
Thus, all 2D values must be transposed when they are used with functions
129+
from `scipy.signal`_.
125130

126131
Types:
127132

@@ -181,7 +186,7 @@ conventions. The currently configurable options allow the units for Bode
181186
plots to be set as dB for gain, degrees for phase and Hertz for frequency
182187
(MATLAB conventions) or the gain can be given in magnitude units (powers of
183188
10), corresponding to the conventions used in `Feedback Systems
184-
<http://www.cds.caltech.edu/~murray/FBSwiki>`_.
189+
<http://fbsbook.org>`_ (FBS).
185190

186191
Variables that can be configured, along with their default values:
187192
* bode_dB (False): Bode plot magnitude plotted in dB (otherwise powers of 10)
@@ -194,6 +199,7 @@ Variables that can be configured, along with their default values:
194199
Functions that can be used to set standard configurations:
195200

196201
.. autosummary::
197-
202+
:toctree: generated/
203+
198204
use_fbs_defaults
199205
use_matlab_defaults

doc/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ implements basic operations for analysis and design of feedback control systems.
1212
- Time response: initial, step, impulse
1313
- Frequency response: Bode and Nyquist plots
1414
- Control analysis: stability, reachability, observability, stability margins
15-
- Control design: eigenvalue placement, linear quadratic regulator
15+
- Control design: eigenvalue placement, LQR, H2, Hinf
16+
- Model reduction: balanced realizations, Hankel singular values
1617
- Estimator design: linear quadratic estimator (Kalman filter)
1718

1819
.. rubric:: Documentation

doc/intro.rst

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,41 @@ Manual. This manual contains information on using the python-control
77
package, including documentation for all functions in the package and
88
examples illustrating their use.
99

10-
Overview of the Toolbox
10+
Overview of the toolbox
1111
=======================
1212

1313
The python-control package is a set of python classes and functions that
1414
implement common operations for the analysis and design of feedback control
1515
systems. The initial goal is to implement all of the functionality required
1616
to work through the examples in the textbook `Feedback Systems
17-
<http://www.cds.caltech.edu/~murray/FBSwiki>`_ by Astrom and Murray. A
18-
MATLAB compatibility package (control.matlab) is available that provides
19-
many of the common functions corresponding to commands available in the
20-
MATLAB Control Systems Toolbox.
17+
<http://fbsbook.org>`_ by Astrom and Murray. A :ref:`matlab-module` is
18+
available that provides many of the common functions corresponding to
19+
commands available in the MATLAB Control Systems Toolbox.
2120

22-
Some Differences from MATLAB
21+
Some differences from MATLAB
2322
============================
24-
The python-control package makes use of NumPy and SciPy. A list of general
25-
differences between NumPy and MATLAB can be found `here
23+
The python-control package makes use of `NumPy <http://www.numpy.org>`_ and
24+
`SciPy <https://www.scipy.org>`_. A list of general differences between
25+
NumPy and MATLAB can be found `here
2626
<http://www.scipy.org/NumPy_for_Matlab_Users>`_.
2727

2828
In terms of the python-control package more specifically, here are
2929
some thing to keep in mind:
3030

3131
* You must include commas in vectors. So [1 2 3] must be [1, 2, 3].
32-
* Functions that return multiple arguments use tuples
33-
* You cannot use braces for collections; use tuples instead
32+
* Functions that return multiple arguments use tuples.
33+
* You cannot use braces for collections; use tuples instead.
3434

3535
Installation
3636
============
3737

38-
The `python-control` package may be installed using pip, conda or the
39-
standard distutils/setuptools mechanisms.
38+
The `python-control` package can be installed using pip, conda or the
39+
standard distutils/setuptools mechanisms. The package requires `numpy`_ and
40+
`scipy`_, and the plotting routines require `matplotlib
41+
<https://matplotlib.org>`_. In addition, some routines require the `slycot
42+
<https://github.com/python-control/Slycot>`_ library in order to implement
43+
more advanced features (including some MIMO functionality).
44+
4045

4146
To install using pip::
4247

@@ -54,9 +59,10 @@ correctly by running the command::
5459
python -c "import slycot"
5560

5661
and verifying that no error message appears. It may be necessary to install
57-
`slycot` from source, which requires a working FORTRAN compiler and the
58-
`lapack` library. More information on the slycot package can be obtained
59-
from the `slycot project page <https://github.com/python-control/Slycot>`_.
62+
`slycot` from source, which requires a working FORTRAN compiler and either
63+
the `lapack` or `openplas` library. More information on the slycot package
64+
can be obtained from the `slycot project page
65+
<https://github.com/python-control/Slycot>`_.
6066

6167
For users with the Anaconda distribution of Python, the following
6268
commands can be used::
@@ -67,8 +73,9 @@ commands can be used::
6773
This installs `slycot` and `python-control` from conda-forge, including the
6874
`openblas` package.
6975

70-
Alternatively, to use setuptools, first `download the source <https://github.com/python-control/python-control/releases>`_ and unpack
71-
it. To install in your home directory, use::
76+
Alternatively, to use setuptools, first `download the source
77+
<https://github.com/python-control/python-control/releases>`_ and unpack it.
78+
To install in your home directory, use::
7279

7380
python setup.py install --user
7481

@@ -77,11 +84,7 @@ or to install for all users (on Linux or Mac OS)::
7784
python setup.py build
7885
sudo python setup.py install
7986

80-
The package requires `numpy` and `scipy`, and the plotting routines require
81-
`matplotlib`. In addition, some routines require the `slycot` module,
82-
described above.
83-
84-
Getting Started
87+
Getting started
8588
===============
8689

8790
There are two different ways to use the package. For the default interface

0 commit comments

Comments
 (0)