Skip to content

Commit 6cbb6f0

Browse files
committed
Restructure config.rst to document all defaults + update docstrings, code
1 parent 668c624 commit 6cbb6f0

10 files changed

Lines changed: 756 additions & 67 deletions

File tree

control/frdata.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,13 @@ def frd(*args, **kwargs):
981981
input_prefix, output_prefix : string, optional
982982
Set the prefix for input and output signals. Defaults = 'u', 'y'.
983983
name : string, optional
984-
System name. If unspecified, a generic name <sys[id]> is generated
985-
with a unique integer id.
984+
Set the name of the system. If unspecified and the system is
985+
sampled from an existing system, the new system name is determined
986+
by adding the prefix and suffix strings in
987+
config.defaults['iosys.sampled_system_name_prefix'] and
988+
config.defaults['iosys.sampled_system_name_suffix'], with the
989+
default being to add the suffix '$ampled'. Otherwise, a generic
990+
name <sys[id]> is generated with a unique integer id
986991
987992
See Also
988993
--------

control/freqplot.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ def bode_plot(
214214
Set the frame of reference used to center the plot title. If set to
215215
'axes' (default), the horizontal position of the title will be
216216
centered relative to the axes. If set to 'figure', it will be
217-
centered with respect to the figure (faster execution).
217+
centered with respect to the figure (faster execution). The
218+
default value can be set using config.defaults['freqplot.title_frame'].
218219
wrap_phase : bool or float
219220
If wrap_phase is `False` (default), then the phase will be unwrapped
220221
so that it is continuously increasing or decreasing. If wrap_phase is
@@ -1203,14 +1204,17 @@ def nyquist_response(
12031204
be set using config.defaults['nyquist.encirclement_threshold'].
12041205
indent_direction : str, optional
12051206
For poles on the imaginary axis, set the direction of indentation to
1206-
be 'right' (default), 'left', or 'none'.
1207+
be 'right' (default), 'left', or 'none'. The default value can
1208+
be set using config.defaults['nyquist.indent_direction'].
12071209
indent_points : int, optional
12081210
Number of points to insert in the Nyquist contour around poles that
12091211
are at or near the imaginary axis.
12101212
indent_radius : float, optional
12111213
Amount to indent the Nyquist contour around poles on or near the
1212-
imaginary axis. Portions of the Nyquist plot corresponding to indented
1213-
portions of the contour are plotted using a different line style.
1214+
imaginary axis. Portions of the Nyquist plot corresponding to
1215+
indented portions of the contour are plotted using a different line
1216+
style. The default value can be set using
1217+
config.defaults['nyquist.indent_radius'].
12141218
omega_limits : array_like of two values
12151219
Set limits for plotted frequency range. If Hz=True the limits are
12161220
in Hz otherwise in rad/s. Specifying ``omega`` as a list of two
@@ -1529,7 +1533,9 @@ def nyquist_plot(
15291533
``omega`` as a list of two elements is equivalent to providing
15301534
``omega_limits``.
15311535
unit_circle : bool, optional
1532-
If ``True``, display the unit circle, to read gain crossover frequency.
1536+
If ``True``, display the unit circle, to read gain crossover
1537+
frequency. The circle style is determined by
1538+
config.defaults['nyquist.circle_style'].
15331539
mt_circles : array_like, optional
15341540
Draw circles corresponding to the given magnitudes of sensitivity.
15351541
ms_circles : array_like, optional
@@ -1567,12 +1573,13 @@ def nyquist_plot(
15671573
arrows : int or 1D/2D array of floats, optional
15681574
Specify the number of arrows to plot on the Nyquist curve. If an
15691575
integer is passed. that number of equally spaced arrows will be
1570-
plotted on each of the primary segment and the mirror image. If a 1D
1571-
array is passed, it should consist of a sorted list of floats between
1572-
0 and 1, indicating the location along the curve to plot an arrow. If
1573-
a 2D array is passed, the first row will be used to specify arrow
1574-
locations for the primary curve and the second row will be used for
1575-
the mirror image.
1576+
plotted on each of the primary segment and the mirror image. If a
1577+
1D array is passed, it should consist of a sorted list of floats
1578+
between 0 and 1, indicating the location along the curve to plot an
1579+
arrow. If a 2D array is passed, the first row will be used to
1580+
specify arrow locations for the primary curve and the second row
1581+
will be used for the mirror image. Default value is 2 and can be
1582+
set using config.defaults['nyquist.arrows'].
15761583
arrow_size : float, optional
15771584
Arrowhead width and length (in display coordinates). Default value is
15781585
8 and can be set using config.defaults['nyquist.arrow_size'].
@@ -1609,11 +1616,14 @@ def nyquist_plot(
16091616
max_curve_magnitude : float, optional
16101617
Restrict the maximum magnitude of the Nyquist plot to this value.
16111618
Portions of the Nyquist plot whose magnitude is restricted are
1612-
plotted using a different line style.
1619+
plotted using a different line style. The default value is 20 and
1620+
can be set using config.defaults['nyquist.max_curve_magnitude'].
16131621
max_curve_offset : float, optional
16141622
When plotting scaled portion of the Nyquist plot, increase/decrease
16151623
the magnitude by this fraction of the max_curve_magnitude to allow
16161624
any overlaps between the primary and mirror curves to be avoided.
1625+
The default value is 0.02 and can be set using
1626+
config.defaults['nyquist.max_curve_magnitude'].
16171627
mirror_style : [str, str] or False
16181628
Linestyles for mirror image of the Nyquist curve. The first element
16191629
is used for unscaled portions of the Nyquist curve, the second element

control/nichols.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def nichols_plot(
5252
Passed to `matplotlib` as the format string for all lines in the plot.
5353
The `omega` parameter must be present (use omega=None if needed).
5454
grid : boolean, optional
55-
True if the plot should include a Nichols-chart grid. Default is True.
55+
True if the plot should include a Nichols-chart grid. Default is
56+
True and can be set using config.defaults['nichols.grid'].
5657
**kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
5758
Additional keywords passed to `matplotlib` to specify line properties.
5859

control/nlsys.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,9 +2319,10 @@ def interconnect(
23192319
23202320
states : int, list of str, or None, optional
23212321
Description of the system states. Same format as `inputs`. The
2322-
default is `None`, in which case the states will be given names of the
2323-
form '<subsys_name>.<state_name>', for each subsys in syslist and each
2324-
state_name of each subsys.
2322+
default is `None`, in which case the states will be given names of
2323+
the form '<subsys_name><delim><state_name>', for each subsys in
2324+
syslist and each state_name of each subsys, where <delim> is the
2325+
value of config.defaults['iosys.state_name_delim'].
23252326
23262327
params : dict, optional
23272328
Parameter values for the systems. Passed to the evaluation functions

control/phaseplot.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
_phaseplot_defaults = {
4949
'phaseplot.arrows': 2, # number of arrows around curve
5050
'phaseplot.arrow_size': 8, # pixel size for arrows
51+
'phaseplot.arrow_style': None, # set arrow style
5152
'phaseplot.separatrices_radius': 0.1 # initial radius for separatrices
5253
}
5354

@@ -120,6 +121,15 @@ def phase_plane_plot(
120121
121122
Other parameters
122123
----------------
124+
arrows : int
125+
Set the number of arrows to plot along the streamlines. The default
126+
value can be set in config.defaults['phaseplot.arrows'].
127+
arrow_size : float
128+
Set the size of arrows to plot along the streamlines. The default
129+
value can be set in config.defaults['phaseplot.arrow_size'].
130+
arrow_style : matplotlib patch
131+
Set the style of arrows to plot along the streamlines. The default
132+
value can be set in config.defaults['phaseplot.arrow_style'].
123133
dir : str, optional
124134
Direction to draw streamlines: 'forward' to flow forward in time
125135
from the reference points, 'reverse' to flow backward in time, or
@@ -384,6 +394,15 @@ def streamlines(
384394
385395
Other parameters
386396
----------------
397+
arrows : int
398+
Set the number of arrows to plot along the streamlines. The default
399+
value can be set in config.defaults['phaseplot.arrows'].
400+
arrow_size : float
401+
Set the size of arrows to plot along the streamlines. The default
402+
value can be set in config.defaults['phaseplot.arrow_size'].
403+
arrow_style : matplotlib patch
404+
Set the style of arrows to plot along the streamlines. The default
405+
value can be set in config.defaults['phaseplot.arrow_style'].
387406
rcParams : dict
388407
Override the default parameters used for generating plots.
389408
Default is set by config.default['ctrlplot.rcParams'].
@@ -594,6 +613,13 @@ def separatrices(
594613
suppress_warnings : bool, optional
595614
If set to `True`, suppress warning messages in generating trajectories.
596615
616+
Notes
617+
-----
618+
The value of config.defaults['separatrices_radius'] is used to set the
619+
offset from the equlibrium point to the starting point of the separatix
620+
traces, in the direction of the eigenvectors evaluated at that
621+
equilibrium point.
622+
597623
"""
598624
# Process keywords
599625
rcParams = config._get_param('ctrlplot', 'rcParams', kwargs, pop=True)

control/pzmap.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Define default parameter values for this module
3636
_pzmap_defaults = {
37-
'pzmap.grid': None, # Plot omega-damping grid
37+
'pzmap.grid': False, # Plot omega-damping grid
3838
'pzmap.marker_size': 6, # Size of the markers
3939
'pzmap.marker_width': 1.5, # Width of the markers
4040
'pzmap.expansion_factor': 1.8, # Amount to scale plots beyond features
@@ -276,16 +276,27 @@ def pole_zero_plot(
276276
277277
Notes
278278
-----
279-
1. By default, the pzmap function calls matplotlib.pyplot.axis('equal'),
280-
which means that trying to reset the axis limits may not behave as
281-
expected. To change the axis limits, use the `scaling` keyword of
282-
use matplotlib.pyplot.gca().axis('auto') and then set the axis
283-
limits to the desired values.
284-
285-
2. Pole/zero plots that use the continuous time omega-damping grid do
286-
not work with the ``ax`` keyword argument, due to the way that axes
287-
grids are implemented. The ``grid`` argument must be set to
288-
``False`` or ``'empty'`` when using the ``ax`` keyword argument.
279+
By default, the pzmap function calls matplotlib.pyplot.axis('equal'),
280+
which means that trying to reset the axis limits may not behave as
281+
expected. To change the axis limits, use the `scaling` keyword of use
282+
matplotlib.pyplot.gca().axis('auto') and then set the axis limits to
283+
the desired values.
284+
285+
Pole/zero plots that use the continuous time omega-damping grid do not
286+
work with the ``ax`` keyword argument, due to the way that axes grids
287+
are implemented. The ``grid`` argument must be set to ``False`` or
288+
``'empty'`` when using the ``ax`` keyword argument.
289+
290+
The limits of the pole/zero plot are set based on the location features
291+
in the plot, including the location of poles, zeros, and local maxima
292+
of root locus curves. The locations of local maxima are expanded by a
293+
buffer factor set by config.defaults['phaseplot.buffer_factor'] that is
294+
applied to the locations of the local maxima. The final axis limits
295+
are set to by the largest features in the plot multiplied by an
296+
expansion factor set by config.defaults['phaseplot.expansion_factor'].
297+
The default value for the buffer factor is 1.05 (5% buffer around local
298+
maxima) and the default value for the expansion factor is 1.8 (80%
299+
increase in limits around the most distant features).
289300
290301
"""
291302
# Get parameter values

control/timeplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def time_response_plot(
154154
trace_labels : list of str, optional
155155
Replace the default trace labels with the given labels.
156156
trace_props : array of dicts
157-
List of line properties to use when plotting combined outputs. The
157+
List of line properties to use when plotting multiple traces. The
158158
default values are set by config.defaults['timeplot.trace_props'].
159159
160160
Notes

0 commit comments

Comments
 (0)