Skip to content

Commit 4b0101c

Browse files
authored
Merge pull request #228 from murrayrm/doc_updates
Documentation updates
2 parents 71101bf + 0a51c27 commit 4b0101c

File tree

13 files changed

+118
-65
lines changed

13 files changed

+118
-65
lines changed

README.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Features
2424
Links
2525
=====
2626

27-
- Project home page: http://python-control.sourceforge.net
27+
- Project home page: http://python-control.org
2828
- Source code repository: https://github.com/python-control/python-control
2929
- Documentation: http://python-control.readthedocs.org/
3030
- Issue tracker: https://github.com/python-control/python-control/issues
@@ -46,7 +46,7 @@ https://github.com/python-control/Slycot
4646
Installation
4747
============
4848

49-
The package may be installed using pip or distutils.
49+
The package may be installed using pip, conda, or distutils.
5050

5151
Pip
5252
---
@@ -56,6 +56,14 @@ To install using pip::
5656
pip install slycot # optional
5757
pip install control
5858

59+
conda-forge
60+
-----------
61+
62+
Binaries are available from conda-forge for selected platforms (Linux and
63+
MacOS). Install using
64+
65+
conda install -c conda-forge control
66+
5967
Distutils
6068
---------
6169

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/frdata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1):
452452
scalar, then the number of inputs and outputs can be specified
453453
manually, as in:
454454
455-
>>> sys = _convertToFRD(3.) # Assumes inputs = outputs = 1
456-
>>> sys = _convertToFRD(1., inputs=3, outputs=2)
455+
>>> frd = _convertToFRD(3., omega) # Assumes inputs = outputs = 1
456+
>>> frd = _convertToFRD(1., omegs, inputs=3, outputs=2)
457457
458458
In the latter example, sys's matrix transfer function is [[1., 1., 1.]
459459
[1., 1., 1.]].

control/freqplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
7070
----------
7171
syslist : linsys
7272
List of linear input/output systems (single system is OK)
73-
omega : freq_range
74-
Range of frequencies in rad/sec
73+
omega : list
74+
List of frequencies in rad/sec to be used for frequency response
7575
dB : boolean
7676
If True, plot result in dB
7777
Hz : boolean
@@ -106,7 +106,7 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
106106
2. If a discrete time model is given, the frequency response is plotted
107107
along the upper branch of the unit circle, using the mapping z = exp(j
108108
\omega dt) where omega ranges from 0 to pi/dt and dt is the discrete
109-
time base. If not timebase is specified (dt = True), dt is set to 1.
109+
timebase. If not timebase is specified (dt = True), dt is set to 1.
110110
111111
Examples
112112
--------

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
----------

control/xferfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ def _convertToTransferFunction(sys, **kw):
10171017
If sys is an array-like type, then it is converted to a constant-gain
10181018
transfer function.
10191019
1020-
>>> sys = _convertToTransferFunction([[1. 0.], [2. 3.]])
1020+
>>> sys = _convertToTransferFunction([[1., 0.], [2., 3.]])
10211021
10221022
In this example, the numerator matrix will be
10231023
[[[1.0], [0.0]], [[2.0], [3.0]]]

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: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ transfer functions
4545
.. math::
4646
4747
G(s) = \frac{\text{num}(s)}{\text{den}(s)}
48-
= \frac{a_0 s^n + a_1 s^{n-1} + \cdots + a_n}
49-
{b_0 s^m + b_1 s^{m-1} + \cdots + b_m},
48+
= \frac{a_0 s^m + a_1 s^{m-1} + \cdots + a_m}
49+
{b_0 s^n + b_1 s^{n-1} + \cdots + b_n},
5050
5151
where n is generally greater than or equal to m (for a proper transfer
5252
function).
@@ -77,23 +77,27 @@ performed.
7777

7878
Discrete time systems
7979
---------------------
80-
By default, all systems are considered to be continuous time systems. A
81-
discrete time system is created by specifying the 'time base' dt. The time
82-
base argument can be given when a system is constructed:
80+
A discrete time system is created by specifying a nonzero 'timebase', dt.
81+
The timebase argument can be given when a system is constructed:
8382

84-
* dt = None: no timebase specified
83+
* dt = None: no timebase specified (default)
8584
* dt = 0: continuous time system
8685
* dt > 0: discrete time system with sampling period 'dt'
8786
* dt = True: discrete time with unspecified sampling period
8887

8988
Only the :class:`StateSpace` and :class:`TransferFunction` classes allow
9089
explicit representation of discrete time systems.
9190

92-
Systems must have the same time base in order to be combined. For
93-
continuous time systems, the :func:`sample_system` function or the
94-
:meth:`StateSpace.sample` and :meth:`TransferFunction.sample` methods can be
95-
used to create a discrete time system from a continuous time system. See
96-
:ref:`utility-and-conversions`.
91+
Systems must have compatible timebases in order to be combined. A system
92+
with timebase `None` can be combined with a system having a specified
93+
timebase; the result will have the timebase of the latter system.
94+
Similarly, a discrete time system with unspecified sampling time (`dt =
95+
True`) can be combined with a system having a specified sampling time;
96+
the result will be a discrete time system with the sample time of the latter
97+
system. For continuous time systems, the :func:`sample_system` function or
98+
the :meth:`StateSpace.sample` and :meth:`TransferFunction.sample` methods
99+
can be used to create a discrete time system from a continuous time system.
100+
See :ref:`utility-and-conversions`.
97101

98102
Conversion between representations
99103
----------------------------------
@@ -106,18 +110,23 @@ argument or using the explicit conversion functions :func:`ss2tf` and
106110

107111
Time series data
108112
================
109-
110-
This is a convention for function arguments and return values that
111-
represent time series: sequences of values that change over time. It
112-
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
113120
:func:`forced_response`, :func:`step_response`, :func:`impulse_response`,
114121
and :func:`initial_response`.
115122

116123
.. note::
117-
This convention is different from the convention used in the library
118-
:mod:`scipy.signal`. In Scipy's convention the meaning of rows and columns
119-
is interchanged. Thus, all 2D values must be transposed when they are
120-
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`_.
121130

122131
Types:
123132

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

182191
Variables that can be configured, along with their default values:
183192
* bode_dB (False): Bode plot magnitude plotted in dB (otherwise powers of 10)
@@ -190,6 +199,7 @@ Variables that can be configured, along with their default values:
190199
Functions that can be used to set standard configurations:
191200

192201
.. autosummary::
193-
202+
:toctree: generated/
203+
194204
use_fbs_defaults
195205
use_matlab_defaults

0 commit comments

Comments
 (0)