Skip to content

Commit b3f33be

Browse files
committed
reformat numbered notes sections
1 parent 480cda7 commit b3f33be

File tree

9 files changed

+107
-109
lines changed

9 files changed

+107
-109
lines changed

control/flatsys/flatsys.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ class FlatSystem(NonlinearIOSystem):
5757
-----
5858
The class must implement two functions:
5959
60-
zflag = flatsys.foward(x, u, params)
60+
``zflag = flatsys.foward(x, u, params)``
61+
6162
This function computes the flag (derivatives) of the flat output.
6263
The inputs to this function are the state 'x' and inputs 'u' (both
6364
1D arrays). The output should be a 2D array with the first
6465
dimension equal to the number of system inputs and the second
6566
dimension of the length required to represent the full system
6667
dynamics (typically the number of states)
6768
68-
x, u = flatsys.reverse(zflag, params)
69+
``x, u = flatsys.reverse(zflag, params)``
70+
6971
This function system state and inputs give the the flag (derivatives)
7072
of the flat output. The input to this function is an 2D array whose
7173
first dimension is equal to the number of system inputs and whose
@@ -737,19 +739,20 @@ def solve_flat_ocp(
737739
738740
Notes
739741
-----
740-
1. Additional keyword parameters can be used to fine tune the behavior
741-
of the underlying optimization function. See `minimize_*` keywords
742-
in `optimal.OptimalControlProblem` for more information.
743-
744-
2. The return data structure includes the following additional attributes:
745-
* success : bool indicating whether the optimization succeeded
746-
* cost : computed cost of the returned trajectory
747-
* message : message returned by optimization if success if False
748-
749-
3. A common failure in solving optimal control problem is that the
750-
default initial guess violates the constraints and the optimizer
751-
can't find a feasible solution. Using the `initial_guess` parameter
752-
can often be used to overcome these errors.
742+
Additional keyword parameters can be used to fine tune the behavior of
743+
the underlying optimization function. See `minimize_*` keywords in
744+
`optimal.OptimalControlProblem` for more information.
745+
746+
The return data structure includes the following additional attributes:
747+
748+
* success : bool indicating whether the optimization succeeded
749+
* cost : computed cost of the returned trajectory
750+
* message : message returned by optimization if success if False
751+
752+
A common failure in solving optimal control problem is that the default
753+
initial guess violates the constraints and the optimizer can't find a
754+
feasible solution. Using the `initial_guess` parameter can often be
755+
used to overcome these errors.
753756
754757
"""
755758
#

control/lti.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,20 @@ def damp(sys, doprint=True):
318318
319319
Notes
320320
-----
321-
If the system is continuous,
322-
wn = abs(poles)
323-
zeta = -real(poles)/poles
321+
If the system is continuous
322+
323+
| ``wn = abs(poles)``
324+
| ``zeta = -real(poles)/poles``
324325
325326
If the system is discrete, the discrete poles are mapped to their
326327
equivalent location in the s-plane via
327328
328-
s = log(poles)/dt
329+
| ``s = log(poles)/dt``
329330
330331
and
331332
332-
wn = abs(s)
333-
zeta = -real(s)/wn.
333+
| ``wn = abs(s)``
334+
| ``zeta = -real(s)/wn``
334335
335336
Examples
336337
--------
@@ -479,20 +480,19 @@ def frequency_response(
479480
480481
Notes
481482
-----
482-
1. This function is a wrapper for `StateSpace.frequency_response`
483-
and `TransferFunction.frequency_response`.
484-
485-
2. You can also use the lower-level methods ``sys(s)`` or ``sys(z)`` to
486-
generate the frequency response for a single system.
487-
488-
3. All frequency data should be given in rad/sec. If frequency limits
489-
are computed automatically, the `Hz` keyword can be used to ensure
490-
that limits are in factors of decades in Hz, so that Bode plots with
491-
``Hz=True`` look better.
492-
493-
4. The frequency response data can be plotted by calling the
494-
`bode_plot` function or using the `plot` method of
495-
the `FrequencyResponseData` class.
483+
This function is a wrapper for `StateSpace.frequency_response` and
484+
`TransferFunction.frequency_response`. You can also use the
485+
lower-level methods ``sys(s)`` or ``sys(z)`` to generate the frequency
486+
response for a single system.
487+
488+
All frequency data should be given in rad/sec. If frequency limits are
489+
computed automatically, the `Hz` keyword can be used to ensure that
490+
limits are in factors of decades in Hz, so that Bode plots with
491+
``Hz=True`` look better.
492+
493+
The frequency response data can be plotted by calling the `bode_plot`
494+
function or using the `plot` method of the `FrequencyResponseData`
495+
class.
496496
497497
Examples
498498
--------

control/nlsys.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,22 +1538,22 @@ def input_output_response(
15381538
15391539
Notes
15401540
-----
1541-
1. If a smaller number of initial conditions are given than the number of
1542-
states in the system, the initial conditions will be padded with
1543-
zeros. This is often useful for interconnected control systems where
1544-
the process dynamics are the first system and all other components
1545-
start with zero initial condition since this can be specified as
1546-
[xsys_0, 0]. A warning is issued if the initial conditions are padded
1547-
and and the final listed initial state is not zero.
1548-
1549-
2. If discontinuous inputs are given, the underlying SciPy numerical
1550-
integration algorithms can sometimes produce erroneous results due
1551-
to the default tolerances that are used. The `ivp_method` and
1552-
`ivp_keywords` parameters can be used to tune the ODE solver and
1553-
produce better results. In particular, using 'LSODA' as the
1554-
`ivp_method` or setting the `rtol` parameter to a smaller value
1555-
(e.g. using ``ivp_kwargs={'rtol': 1e-4}``) can provide more accurate
1556-
results.
1541+
If a smaller number of initial conditions are given than the number of
1542+
states in the system, the initial conditions will be padded with zeros.
1543+
This is often useful for interconnected control systems where the
1544+
process dynamics are the first system and all other components start
1545+
with zero initial condition since this can be specified as [xsys_0, 0].
1546+
A warning is issued if the initial conditions are padded and and the
1547+
final listed initial state is not zero.
1548+
1549+
If discontinuous inputs are given, the underlying SciPy numerical
1550+
integration algorithms can sometimes produce erroneous results due to
1551+
the default tolerances that are used. The `ivp_method` and
1552+
`ivp_keywords` parameters can be used to tune the ODE solver and
1553+
produce better results. In particular, using 'LSODA' as the
1554+
`ivp_method` or setting the `rtol` parameter to a smaller value
1555+
(e.g. using ``ivp_kwargs={'rtol': 1e-4}``) can provide more accurate
1556+
results.
15571557
15581558
"""
15591559
#

control/optimal.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,19 +1111,19 @@ def solve_ocp(
11111111
11121112
Notes
11131113
-----
1114-
1. For discrete time systems, the final value of the timepts vector
1115-
specifies the final time t_N, and the trajectory cost is computed
1116-
from time t_0 to t_{N-1}. Note that the input u_N does not affect
1117-
the state x_N and so it should always be returned as 0. Further, if
1118-
neither a terminal cost nor a terminal constraint is given, then the
1119-
input at time point t_{N-1} does not affect the cost function and
1120-
hence u_{N-1} will also be returned as zero. If you want the
1121-
trajectory cost to include state costs at time t_{N}, then you can
1122-
set `terminal_cost` to be the same function as `cost`.
1123-
1124-
2. Additional keyword parameters can be used to fine-tune the behavior
1125-
of the underlying optimization and integration functions. See
1126-
`OptimalControlProblem` for more information.
1114+
For discrete time systems, the final value of the timepts vector
1115+
specifies the final time t_N, and the trajectory cost is computed from
1116+
time t_0 to t_{N-1}. Note that the input u_N does not affect the state
1117+
x_N and so it should always be returned as 0. Further, if neither a
1118+
terminal cost nor a terminal constraint is given, then the input at
1119+
time point t_{N-1} does not affect the cost function and hence u_{N-1}
1120+
will also be returned as zero. If you want the trajectory cost to
1121+
include state costs at time t_{N}, then you can set `terminal_cost` to
1122+
be the same function as `cost`.
1123+
1124+
Additional keyword parameters can be used to fine-tune the behavior of
1125+
the underlying optimization and integration functions. See
1126+
`OptimalControlProblem` for more information.
11271127
11281128
"""
11291129
# Process keyword arguments

control/statefbk.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ def place(A, B, p):
6666
6767
Notes
6868
-----
69-
Algorithm
70-
This is a wrapper function for `scipy.signal.place_poles`, which
71-
implements the Tits and Yang algorithm [1]_. It will handle SISO,
72-
MISO, and MIMO systems. If you want more control over the algorithm,
73-
use `scipy.signal.place_poles` directly.
74-
75-
Limitations
76-
The algorithm will not place poles at the same location more
77-
than rank(B) times.
69+
This is a wrapper function for `scipy.signal.place_poles`, which
70+
implements the Tits and Yang algorithm [1]_. It will handle SISO, MISO,
71+
and MIMO systems. If you want more control over the algorithm, use
72+
`scipy.signal.place_poles` directly.
73+
74+
Limitations: The algorithm will not place poles at the same location
75+
more than rank(B) times.
7876
7977
References
8078
----------

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
12721272
12731273
Notes
12741274
-----
1275-
Uses `scipy.signal.cont2discrete`
1275+
Uses `scipy.signal.cont2discrete`.
12761276
12771277
Examples
12781278
--------

control/timeplot.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,21 @@ def time_response_plot(
160160
161161
Notes
162162
-----
163-
1. A new figure will be generated if there is no current figure or
164-
the current figure has an incompatible number of axes. To
165-
force the creation of a new figures, use `plt.figure`. To reuse
166-
a portion of an existing figure, use the ``ax`` keyword.
167-
168-
2. The line properties (color, linestyle, etc) can be set for the
169-
entire plot using the `fmt` and/or `kwargs` parameter, which
170-
are passed on to `matplotlib`. When combining signals or
171-
traces, the `input_props`, `output_props`, and `trace_props`
172-
parameters can be used to pass a list of dictionaries
173-
containing the line properties to use. These input/output
174-
properties are combined with the trace properties and finally
175-
the kwarg properties to determine the final line properties.
176-
177-
3. The default plot properties, such as font sizes, can be set using
178-
`config.defaults[''timeplot.rcParams']`.
163+
A new figure will be generated if there is no current figure or the
164+
current figure has an incompatible number of axes. To force the
165+
creation of a new figures, use `plt.figure`. To reuse a portion of an
166+
existing figure, use the ``ax`` keyword.
167+
168+
The line properties (color, linestyle, etc) can be set for the entire
169+
plot using the `fmt` and/or `kwargs` parameter, which are passed on to
170+
`matplotlib`. When combining signals or traces, the `input_props`,
171+
`output_props`, and `trace_props` parameters can be used to pass a list
172+
of dictionaries containing the line properties to use. These
173+
input/output properties are combined with the trace properties and
174+
finally the kwarg properties to determine the final line properties.
175+
176+
The default plot properties, such as font sizes, can be set using
177+
`config.defaults[''timeplot.rcParams']`.
179178
180179
"""
181180
from .ctrlplot import _process_ax_keyword, _process_line_labels

control/timeresp.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -997,22 +997,22 @@ def forced_response(sysdata, T=None, U=0., X0=0., transpose=False, params=None,
997997
998998
Notes
999999
-----
1000-
1. For discrete time systems, the input/output response is computed
1001-
using the `scipy.signal.dlsim` function.
1002-
1003-
2. For continuous time systems, the output is computed using the matrix
1004-
exponential ``exp(A t)`` and assuming linear interpolation of the
1005-
inputs between time points.
1006-
1007-
3. If a nonlinear I/O system is passed to `forced_response`, the
1008-
`input_output_response` function is called instead. The main
1009-
difference between `input_output_response` and `forced_response` is
1010-
that `forced_response` is specialized (and optimized) for linear
1011-
systems.
1012-
1013-
4. (legacy) The return value of the system can also be accessed by
1014-
assigning the function to a tuple of length 2 (time, output) or of
1015-
length 3 (time, output, state) if `return_x` is True.
1000+
For discrete time systems, the input/output response is computed
1001+
using the `scipy.signal.dlsim` function.
1002+
1003+
For continuous time systems, the output is computed using the
1004+
matrix exponential ``exp(A t)`` and assuming linear interpolation
1005+
of the inputs between time points.
1006+
1007+
If a nonlinear I/O system is passed to `forced_response`, the
1008+
`input_output_response` function is called instead. The main
1009+
difference between `input_output_response` and `forced_response`
1010+
is that `forced_response` is specialized (and optimized) for
1011+
linear systems.
1012+
1013+
(legacy) The return value of the system can also be accessed by
1014+
assigning the function to a tuple of length 2 (time, output) or of
1015+
length 3 (time, output, state) if `return_x` is True.
10161016
10171017
Examples
10181018
--------

control/xferfcn.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,9 +1168,7 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
11681168
11691169
Notes
11701170
-----
1171-
1. Available only for SISO systems
1172-
1173-
2. Uses `scipy.signal.cont2discrete`
1171+
Available only for SISO systems. Uses `scipy.signal.cont2discrete`.
11741172
11751173
Examples
11761174
--------

0 commit comments

Comments
 (0)