8000 improve class documentation in Reference Manual · python-control/python-control@370e95b · GitHub
[go: up one dir, main page]

Skip to content

Commit 370e95b

Browse files
committed
improve class documentation in Reference Manual
1 parent 121a539 commit 370e95b

File tree

15 files changed

+83
-36
lines changed

15 files changed

+83
-36
lines changed

control/ctrlplot.py

Lines changed: 2 additions & 2 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def _get_color_offset(ax, color_cycle=None):
685685
686686
Parameters
687687
----------
688-
ax : matplotlib.axes.Axes
688+
ax : `matplotlib.axes.Axes`
689689
Axes containing already plotted lines.
690690
color_cycle : list of matplotlib color specs, optional
691691
Colors to use in plotting lines. Defaults to matplotlib rcParams
@@ -727,7 +727,7 @@ def _get_color(
727727
Offset into the color cycle (for multi-trace plots).
728728
fmt : str, optional
729729
Format string passed to plotting command.
730-
ax : matplotlib.axes.Axes, optional
730+
ax : `matplotlib.axes.Axes`, optional
731731
Axes containing already plotted lines.
732732
lines : list of matplotlib.lines.Line2D, optional
733733
List of plotted lines. If not given, use ax.get_lines().

control/descfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def describing_function_pl 8000 ot(
444444
point_label : str, optional
445445
Formatting string used to label intersection points on the Nyquist
446446
plot. Defaults to "%5.2g @ %-5.2g". Set to None to omit labels.
447-
ax : matplotlib.axes.Axes, optional
447+
ax : `matplotlib.axes.Axes`, optional
448448
The matplotlib axes to draw the figure on. If not specified and
449449
the current figure has a single axes, that axes is used.
450450
Otherwise, a new figure is created.

control/freqplot.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,15 @@
6767
#
6868

6969
class FrequencyResponseList(list):
70+
"""List of FrequencyResponseData objects with plotting capability.
71+
72+
This class consists of a list of `FrequencyResponseData` objects.
73+
It is a subclass of the Python `list` class, with a `plot` method that
74+
plots the individual `FrequencyResponseData` objects.
75+
76+
"""
7077
def plot(self, *args, plot_type=None, **kwargs):
71-
"""List of FrequencyResponseData objects with plotting capability.
78+
"""Plot a list of frequency responses.
7279
7380
See `FrequencyResponseData.plot` for details.
7481
@@ -150,7 +157,7 @@ def bode_plot(
150157
151158
Other Parameters
152159
----------------
153-
ax : array of matplotlib.axes.Axes, optional
160+
ax : array of `matplotlib.axes.Axes`, optional
154161
The matplotlib axes to draw the figure on. If not specified, the
155162
axes for the current figure are used or, if there is no current
156163
figure with the correct number and shape of axes, a new figure is
@@ -1614,7 +1621,7 @@ def nyquist_plot(
16141621
8 and can be set using `config.defaults['nyquist.arrow_size']`.
16151622
arrow_style : matplotlib.patches.ArrowStyle, optional
16161623
Define style used for Nyquist curve arrows (overrides `arrow_size`).
1617-
ax : matplotlib.axes.Axes, optional
1624+
ax : `matplotlib.axes.Axes`, optional
16181625
The matplotlib axes to draw the figure on. If not specified and
16191626
the current figure has a single axes, that axes is used.
16201627
Otherwise, a new figure is created.
@@ -2395,7 +2402,7 @@ def singular_values_plot(
23952402
23962403
Other Parameters
23972404
----------------
2398-
ax : matplotlib.axes.Axes, optional
2405+
ax : `matplotlib.axes.Axes`, optional
23992406
The matplotlib axes to draw the figure on. If not specified and
24002407
the current figure has a single axes, that axes is used.
24012408
Otherwise, a new figure is created.

control/iosys.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def repr_format(self):
322322
323323
Format used in creating the representation for the system:
324324
325-
* 'info' : <IOSystemType:sysname:[inputs] -> [outputs]>
325+
* 'info' : <IOSystemType sysname: [inputs] -> [outputs]>
326326
* 'eval' : system specific, loadable representation
327327
* 'latex' : HTML/LaTeX representation of the object
328328
@@ -537,7 +537,8 @@ def find_inputs(self, name_list):
537537
# Property for getting and setting list of input signals
538538
input_labels = property(
539539
lambda self: list(self.input_index.keys()), # getter
540-
set_inputs) # setter
540+
set_inputs, # setter
541+
doc="List of labels for the input signals.")
541542

542543
def set_outputs(self, outputs, prefix='y'):
543544
"""Set the number/names of the system outputs.
@@ -598,7 +599,8 @@ def find_outputs(self, name_list):
598599
# Property for getting and setting list of output signals
599600
output_labels = property(
600601
lambda self: list(self.output_index.keys()), # getter
601-
set_outputs) # setter
602+
set_outputs, # setter
603+
doc="List of labels for the output signals.")
602604

603605
def set_states(self, states, prefix='x'):
604606
"""Set the number/names of the system states.
@@ -659,7 +661,8 @@ def find_states(self, name_list):
659661
# Property for getting and setting list of state signals
660662
state_labels = property(
661663
lambda self: list(self.state_index.keys()), # getter
662-
set_states) # setter
664+
set_states, # setter
665+
doc="List of labels for the state signals.")
663666

664667
@property
665668
def shape(self):
@@ -942,7 +945,7 @@ def iosys_repr(sys, format=None):
942945
format : str
943946
Format to use in creating the representation:
944947
945-
* 'info' : <IOSystemType:sysname:[inputs] -> [outputs]>
948+
* 'info' : <IOSystemType sysname: [inputs] -> [outputs]>
946949
* 'eval' : system specific, loadable representation
947950
* 'latex' : HTML/LaTeX representation of the object
948951

control/lti.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
class LTI(InputOutputSystem):
2626
"""Parent class for linear time-invariant system objects.
2727
28-
LTI is the parent to the `StateSpace` and `TransferFunction` child
29-
classes. It contains the number of inputs and outputs, and the timebase
30-
(dt) for the system. This class is not generally accessed directly by
31-
the user.
28+
LTI is the parent to the `FrequencyResponseData`, `StateSpace`, and
29+
`TransferFunction` child classes. It contains the number of inputs and
30+
outputs, and the timebase (dt) for the system. This class is not
31+
generally accessed directly by the user.
3232
3333
See Also
3434
--------
@@ -78,7 +78,7 @@ def __call__(self, x, squeeze=None, warn_infinite=True):
7878
7979
Notes
8080
-----
81-
See `FrequencyResponseData`.__call__`, `StateSpace.__call__`,
81+
See `FrequencyResponseData.__call__`, `StateSpace.__call__`,
8282
`TransferFunction.__call__` for class-specific details.
8383
8484
"""

control/nichols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def nichols_plot(
6666
6767
Other Parameters
6868
----------------
69-
ax : matplotlib.axes.Axes, optional
69+
ax : `matplotlib.axes.Axes`, optional
7070
The matplotlib axes to draw the figure on. If not specified and
7171
the current figure has a single axes, that axes is used.
7272
Otherwise, a new figure is created.
@@ -191,7 +191,7 @@ def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted', ax=None,
191191
line_style : string, optional
192192
:doc:`Matplotlib linestyle \
193193
<matplotlib:gallery/lines_bars_and_markers/linestyles>`.
194-
ax : matplotlib.axes.Axes, optional
194+
ax : `matplotlib.axes.Axes`, optional
195195
Axes to add grid to. If None, use `matplotlib.pyplot.gca`.
196196
label_cl_phases : bool, optional
197197
If True, closed-loop phase lines will be labeled.

control/phaseplot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def phase_plane_plot(
8989
Plot all elements in the given color (use ``plot_<element>`` =
9090
{'color': c} to set the color in one element of the phase
9191
plot (equilpoints, separatrices, streamlines, etc).
92-
ax : matplotlib.axes.Axes, optional
92+
ax : `matplotlib.axes.Axes`, optional
9393
The matplotlib axes to draw the figure on. If not specified and
9494
the current figure has a single axes, that axes is used.
9595
Otherwise, a new figure is created.
@@ -276,7 +276,7 @@ def vectorfield(
276276
dict with key 'args' and value given by a tuple (passed to callable).
277277
color : matplotlib color spec, optional
278278
Plot the vector field in the given color.
279-
ax : matplotlib.axes.Axes
279+
ax : `matplotlib.axes.Axes`, optional
280280
Use the given axes for the plot, otherwise use the current axes.
281281
282282
Returns
@@ -377,7 +377,7 @@ def streamlines(
377377
dict with key 'args' and value given by a tuple (passed to callable).
378378
color : str
379379
Plot the streamlines in the given color.
380-
ax : matplotlib.axes.Axes
380+
ax : `matplotlib.axes.Axes`, optional
381381
Use the given axes for the plot, otherwise use the current axes.
382382
383383
Returns
@@ -498,7 +498,7 @@ def equilpoints(
498498
dict with key 'args' and value given by a tuple (passed to callable).
499499
color : str
500500
Plot the equilibrium points in the given color.
501-
ax : matplotlib.axes.Axes
501+
ax : `matplotlib.axes.Axes`, optional
502502
Use the given axes for the plot, otherwise use the current axes.
503503
504504
Returns
@@ -590,7 +590,7 @@ def separatrices(
590590
separatrices. If a tuple is given, the first element is used as
591591
the color specification for stable separatrices and the second
592592
element for unstable separatrices.
593-
ax : matplotlib.axes.Axes
593+
ax : `matplotlib.axes.Axes`, optional
594594
Use the given axes for the plot, otherwise use the current axes.
595595
596596
Returns

control/pzmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def pole_zero_plot(
218218
219219
Other Parameters
220220
----------------
221-
ax : matplotlib.axes.Axes, optional
221+
ax : `matplotlib.axes.Axes`, optional
222222
The matplotlib axes to draw the figure on. If not specified and
223223
the current figure has a single axes, that axes is used.
224224
Otherwise, a new figure is created.

control/rlocus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def root_locus_plot(
154154
155155
Other Parameters
156156
----------------
157-
ax : matplotlib.axes.Axes, optional
157+
ax : `matplotlib.axes.Axes`, optional
158158
The matplotlib axes to draw the figure on. If not specified and
159159
the current figure has a single axes, that axes is used.
160160
Otherwise, a new figure is created.

control/tests/ctrlplot_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ def test_plot_ax_processing(resp_fcn, plot_fcn):
247247
# Make sure that docstring documents ax keyword
248248
if plot_fcn not in legacy_plot_fcns:
249249
if plot_fcn in multiaxes_plot_fcns:
250-
assert "ax : array of matplotlib.axes.Axes, optional" \
250+
assert "ax : array of `matplotlib.axes.Axes`, optional" \
251251
in plot_fcn.__doc__
252252
else:
253-
assert "ax : matplotlib.axes.Axes, optional" in plot_fcn.__doc__
253+
assert "ax : `matplotlib.axes.Axes`, optional" in plot_fcn.__doc__
254254

255255

256256
@pytest.mark.parametrize("resp_fcn, plot_fcn", resp_plot_fcns)

0 commit comments

Comments
 (0)
0