8000 update class documentation (+ unit tests) · murrayrm/python-control@81b1c6f · GitHub
[go: up one dir, main page]

Skip to content

Commit 81b1c6f

Browse files
committed
update class documentation (+ unit tests)
1 parent db7fc1a commit 81b1c6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1115
-705
lines changed

control/bdalg.py

Lines changed: 24 additions & 24 deletions
10000
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def series(*sys, **kwargs):
5353
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
5454
name : string, optional
5555
System name (used for specifying signals). If unspecified, a generic
56-
name <sys[id]> is generated with a unique integer id.
56+
name 'sys[id]' is generated with a unique integer id.
5757
5858
Raises
5959
------
@@ -124,7 +124,7 @@ def parallel(*sys, **kwargs):
124124
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
125125
name : string, optional
126126
System name (used for specifying signals). If unspecified, a generic
127-
name <sys[id]> is generated with a unique integer id.
127+
name 'sys[id]' is generated with a unique integer id.
128128
129129
Raises
130130
------
@@ -139,7 +139,7 @@ def parallel(*sys, **kwargs):
139139
Notes
140140
-----
141141
This function is a wrapper for the __add__ function in the
142-
StateSpace and TransferFunction classes. The output type is usually
142+
`StateSpace` and `TransferFunction` classes. The output type is usually
143143
the type of `sys1`. If `sys1` is a scalar, then the output type is
144144
the type of `sys2`.
145145
@@ -168,8 +168,7 @@ def parallel(*sys, **kwargs):
168168
return sys
169169

170170
def negate(sys, **kwargs):
171-
"""
172-
Return the negative of a system.
171+
"""Return the negative of a system.
173172
174173
Parameters
175174
----------
@@ -193,16 +192,17 @@ def negate(sys, **kwargs):
193192
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
194193
name : string, optional
195194
System name (used for specifying signals). If unspecified, a generic
196-
name <sys[id]> is generated with a unique integer id.
195+
name 'sys[id]' is generated with a unique integer id.
197196
198197
See Also
199198
--------
200199
append, feedback, interconnect, parallel, series
201200
202201
Notes
203202
-----
204-
This function is a wrapper for the __neg__ function in the StateSpace and
205-
TransferFunction classes. The output type is the same as the input type.
203+
This function is a wrapper for the __neg__ function in the `StateSpace`
204+
and `TransferFunction` classes. The output type is the same as the
205+
input type.
206206
207207
Examples
208208
--------
@@ -248,16 +248,16 @@ def feedback(sys1, sys2=1, sign=-1, **kwargs):
248248
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
249249
name : string, optional
250250
System name (used for specifying signals). If unspecified, a generic
251-
name <sys[id]> is generated with a unique integer id.
251+
name 'sys[id]' is generated with a unique integer id.
252252
253253
Raises
254254
------
255255
ValueError
256-
if `sys1` does not have as many inputs as `sys2` has outputs, or if
257-
`sys2` does not have as many inputs as `sys1` has outputs
256+
If `sys1` does not have as many inputs as `sys2` has outputs, or if
257+
`sys2` does not have as many inputs as `sys1` has outputs.
258258
NotImplementedError
259-
if an attempt is made to perform a feedback on a MIMO TransferFunction
260-
object
259+
If an attempt is made to perform a feedback on a MIMO `TransferFunction`
260+
object.
261261
262262
See Also
263263
--------
@@ -341,7 +341,7 @@ def append(*sys, **kwargs):
341341
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
342342
name : string, optional
343343
System name (used for specifying signals). If unspecified, a generic
344-
name <sys[id]> is generated with a unique integer id.
344+
name 'sys[id]' is generated with a unique integer id.
345345
346346
See Also
347347
--------
@@ -472,16 +472,16 @@ def combine_tf(tf_array, **kwargs):
472472
473473
Parameters
474474
----------
475-
tf_array : list of list of TransferFunction or array_like
475+
tf_array : list of list of `TransferFunction` or array_like
476476
Transfer matrix represented as a two-dimensional array or
477-
list-of-lists containing TransferFunction objects. The
477+
list-of-lists containing `TransferFunction` objects. The
478478
`TransferFunction` objects can have multiple outputs and inputs, as
479479
long as the dimensions are compatible.
480480
481481
Returns
482482
-------
483-
TransferFunction
484-
Transfer matrix represented as a single MIMO TransferFunction object.
483+
`TransferFunction`
484+
Transfer matrix represented as a single MIMO `TransferFunction` object.
485485
486486
Other Parameters
487487
----------------
@@ -491,7 +491,7 @@ def combine_tf(tf_array, **kwargs):
491491
or 'y'). See `InputOutputSystem` for more information.
492492
name : string, optional
493493
System name (used for specifying signals). If unspecified, a generic
494-
name <sys[id]> is generated with a unique integer id.
494+
name 'sys[id]' is generated with a unique integer id.
495495
496496
Raises
497497
------
@@ -603,7 +603,7 @@ def split_tf(transfer_function):
603603
604604
Parameters
605605
----------
606-
transfer_function : TransferFunction
606+
transfer_function : `TransferFunction`
607607
MIMO transfer function to split.
608608
609609
Returns
@@ -658,11 +658,11 @@ def split_tf(transfer_function):
658658
return np.array(tf_split_lst, dtype=object)
659659

660660
def _ensure_tf(arraylike_or_tf, dt=None):
661-
"""Convert an array-like to a transfer function.
661+
"""Convert an array_like to a transfer function.
662662
663663
Parameters
664664
----------
665-
arraylike_or_tf : TransferFunction or array_like
665+
arraylike_or_tf : `TransferFunction` or array_like
666666
Array-like or transfer function.
667667
dt : None, True or float, optional
668668
System timebase. 0 (default) indicates continuous
@@ -673,7 +673,7 @@ def _ensure_tf(arraylike_or_tf, dt=None):
673673
674674
Returns
675675
-------
676-
TransferFunction
676+
`TransferFunction`
677677
Transfer function.
678678
679679
Raises
@@ -707,7 +707,7 @@ def _ensure_tf(arraylike_or_tf, dt=None):
707707
)
708708
except TypeError:
709709
raise ValueError(
710-
"`arraylike_or_tf` must only contain array-likes or transfer "
710+
"`arraylike_or_tf` must only contain array_likes or transfer "
711711
"functions."
712712
)
713713
return tfn

control/canonical.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def canonical_form(xsys, form='reachable'):
2525
2626
Parameters
2727
----------
28-
xsys : StateSpace object
28+
xsys : `StateSpace` object
2929
System to be transformed, with state 'x'.
3030
form : str
3131
Canonical form for transformation. Chosen from:
@@ -35,7 +35,7 @@ def canonical_form(xsys, form='reachable'):
3535
3636
Returns
3737
-------
38-
zsys : StateSpace object
38+
zsys : `StateSpace` object
3939
System in desired canonical form, with state 'z'.
4040
T : (M, M) real ndarray
4141
Coordinate transformation matrix, z = T * x.
@@ -77,12 +77,12 @@ def reachable_form(xsys):
7777
7878
Parameters
7979
----------
80-
xsys : StateSpace object
80+
xsys : `StateSpace` object
8181
System to be transformed, with state `x`.
8282
8383
Returns
8484
-------
85-
zsys : StateSpace object
85+
zsys : `StateSpace` object
8686
System in reachable canonical form, with state `z`.
8787
T : (M, M) real ndarray
8888
Coordinate transformation: z = T * x.
@@ -142,12 +142,12 @@ def observable_form(xsys):
142142
143143
Parameters
144144
----------
145-
xsys : StateSpace object
145+
xsys : `StateSpace` object
146146
System to be transformed, with state `x`.
147147
148148
Returns
149149
-------
150-
zsys : StateSpace object
150+
zsys : `StateSpace` object
151151
System in observable canonical form, with state `z`.
152152
T : (M, M) real ndarray
153153
Coordinate transformation: z = T * x.
@@ -203,7 +203,7 @@ def similarity_transform(xsys, T, timescale=1, inverse=False):
203203
204204
Parameters
205205
----------
206-
xsys : StateSpace object
206+
xsys : `StateSpace` object
207207
System to transform.
208208
T : (M, M) array_like
209209
The matrix `T` defines the new set of coordinates z = T x.
@@ -215,7 +215,7 @@ def similarity_transform(xsys, T, timescale=1, inverse=False):
215215
216216
Returns
217217
-------
218-
zsys : StateSpace object
218+
zsys : `StateSpace` object
219219
System in transformed coordinates, with state 'z'.
220220
221221
See Also
@@ -497,7 +497,7 @@ def modal_form(xsys, condmax=None, sort=False):
497497
498498
Parameters
499499
----------
500-
xsys : StateSpace object
500+
xsys : `StateSpace` object
501501
System to be transformed, with state x.
502502
condmax : None or float, optional
503503
An upper bound on individual transformations. If None, use
@@ -508,9 +508,9 @@ def modal_form(xsys, condmax=None, sort=False):
508508
509509
Returns
510510
-------
511-
zsys : StateSpace object
511+
zsys : `StateSpace` object
512512
System in modal canonical form, with state z.
513-
T : (M, M) ndarray
513+
T : (M, M) array
514514
Coordinate transformation: z = T * x.
515515
516516
Examples

control/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
class DefaultDict(collections.UserDict):
32-
"""Map names for settings from older version to their renamed ones.
32+
"""Default parameters dictionary, with legacy warnings.
3333
3434
If a user wants to write to an old setting, issue a warning and write to
3535
the renamed setting instead. Accessing the old setting returns the value

control/ctrlplot.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
#
123123

124124
class ControlPlot():
125-
"""A class for representing control figures.
125+
"""Return class for control platting functions.
126126
127127
This class is used as the return type for control plotting functions.
128128
It contains the information required to access portions of the plot
@@ -136,17 +136,17 @@ class ControlPlot():
136136
137137
Parameters
138138
----------
139-
lines : array of list of `matplotlib:Line2D`
139+
lines : array of list of `matplotlib.lines.Line2D`
140140
Array of Line2D objects for each line in the plot. Generally, the
141141
shape of the array matches the subplots shape and the value of the
142142
array is a list of Line2D objects in that subplot. Some plotting
143143
functions will return variants of this structure, as described in
144144
the individual documentation for the functions.
145-
axes : 2D array of `matplotlib:Axes`
145+
axes : 2D array of `matplotlib.axes.Axes`
146146
Array of Axes objects for each subplot in the plot.
147-
figure : `matplotlib:Figure`
147+
figure : `matplotlib.figure.Figure`
148148
Figure on which the Axes are drawn.
149-
legend : `matplotlib:.legend.Legend` (instance or ndarray)
149+
legend : `matplotlib.legend.Legend` (instance or ndarray)
150150
Legend object(s) for the plot. If more than one legend is
151151
included, this will be an array with each entry being either None
152152
(for no legend) or a legend object.
@@ -176,6 +176,7 @@ def __setitem__(self, item, val):
176176
self.lines[item] = val
177177
shape = property(lambda self: self.lines.shape, None)
178178
def reshape(self, *args):
179+
"""Reshape lines array (legacy)."""
179180
return self.lines.reshape(*args)
180181

181182
def set_plot_title(self, title, frame='axes'):
@@ -310,11 +311,11 @@ def pole_zero_subplots(
310311
case 'empty', _: # empty grid
311312
ax_array[row, col] = fig.add_subplot(nrows, ncols, index+1)
312313

313-
case True, True: # continuous time grid
314+
case True, True: # continuous-time grid
314315
ax_array[row, col], _ = sgrid(
315316
(nrows, ncols, index+1), scaling=scaling)
316317

317-
case True, False: # discrete time grid
318+
case True, False: # discrete-time grid
318319
ax_array[row, col] = fig.add_subplot(nrows, ncols, index+1)
319320
zgrid(ax=ax_array[row, col], scaling=scaling)
320321

0 commit comments

Comments
 (0)
1639
0