Skip to content

Commit b750119

Browse files
committed
Restructure config.rst to document all defaults + update docstrings, code
1 parent 322dba6 commit b750119

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
@@ -1014,8 +1014,13 @@ def frd(*args, **kwargs):
10141014
input_prefix, output_prefix : string, optional
10151015
Set the prefix for input and output signals. Defaults = 'u', 'y'.
10161016
name : string, optional
1017-
System name. If unspecified, a generic name <sys[id]> is generated
1018-
with a unique integer id.
1017+
Set the name of the system. If unspecified and the system is
1018+
sampled from an existing system, the new system name is determined
1019+
by adding the prefix and suffix strings in
1020+
config.defaults['iosys.sampled_system_name_prefix'] and
1021+
config.defaults['iosys.sampled_system_name_suffix'], with the
1022+
default being to add the suffix '$ampled'. Otherwise, a generic
1023+
name <sys[id]> is generated with a unique integer id
10191024
10201025
See Also
10211026
--------

control/freqplot.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ def bode_plot(
213213
Set the frame of reference used to center the plot title. If set to
214214
'axes' (default), the horizontal position of the title will be
215215
centered relative to the axes. If set to 'figure', it will be
216-
centered with respect to the figure (faster execution).
216+
centered with respect to the figure (faster execution). The
217+
default value can be set using config.defaults['freqplot.title_frame'].
217218
wrap_phase : bool or float
218219
If wrap_phase is `False` (default), then the phase will be unwrapped
219220
so that it is continuously increasing or decreasing. If wrap_phase is
@@ -1200,14 +1201,17 @@ def nyquist_response(
12001201
be set using config.defaults['nyquist.encirclement_threshold'].
12011202
indent_direction : str, optional
12021203
For poles on the imaginary axis, set the direction of indentation to
1203-
be 'right' (default), 'left', or 'none'.
1204+
be 'right' (default), 'left', or 'none'. The default value can
1205+
be set using config.defaults['nyquist.indent_direction'].
12041206
indent_points : int, optional
12051207
Number of points to insert in the Nyquist contour around poles that
12061208
are at or near the imaginary axis.
12071209
indent_radius : float, optional
12081210
Amount to indent the Nyquist contour around poles on or near the
1209-
imaginary axis. Portions of the Nyquist plot corresponding to indented
1210-
portions of the contour are plotted using a different line style.
1211+
imaginary axis. Portions of the Nyquist plot corresponding to
1212+
indented portions of the contour are plotted using a different line
1213+
style. The default value can be set using
1214+
config.defaults['nyquist.indent_radius'].
12111215
omega_limits : array_like of two values
12121216
Set limits for plotted frequency range. If Hz=True the limits are
12131217
in Hz otherwise in rad/s. Specifying ``omega`` as a list of two
@@ -1539,7 +1543,9 @@ def nyquist_plot(
15391543
``omega`` as a list of two elements is equivalent to providing
15401544
``omega_limits``.
15411545
unit_circle : bool, optional
1542-
If ``True``, display the unit circle, to read gain crossover frequency.
1546+
If ``True``, display the unit circle, to read gain crossover
1547+
frequency. The circle style is determined by
1548+
config.defaults['nyquist.circle_style'].
15431549
mt_circles : array_like, optional
15441550
Draw circles corresponding to the given magnitudes of sensitivity.
15451551
ms_circles : array_like, optional
@@ -1577,12 +1583,13 @@ def nyquist_plot(
15771583
arrows : int or 1D/2D array of floats, optional
15781584
Specify the number of arrows to plot on the Nyquist curve. If an
15791585
integer is passed. that number of equally spaced arrows will be
1580-
plotted on each of the primary segment and the mirror image. If a 1D
1581-
array is passed, it should consist of a sorted list of floats between
1582-
0 and 1, indicating the location along the curve to plot an arrow. If
1583-
a 2D array is passed, the first row will be used to specify arrow
1584-
locations for the primary curve and the second row will be used for
1585-
the mirror image.
1586+
plotted on each of the primary segment and the mirror image. If a
1587+
1D array is passed, it should consist of a sorted list of floats
1588+
between 0 and 1, indicating the location along the curve to plot an
1589+
arrow. If a 2D array is passed, the first row will be used to
1590+
specify arrow locations for the primary curve and the second row
1591+
will be used for the mirror image. Default value is 2 and can be
1592+
set using config.defaults['nyquist.arrows'].
15861593
arrow_size : float, optional
15871594
Arrowhead width and length (in display coordinates). Default value is
15881595
8 and can be set using config.defaults['nyquist.arrow_size'].
@@ -1619,11 +1626,14 @@ def nyquist_plot(
16191626
max_curve_magnitude : float, optional
16201627
Restrict the maximum magnitude of the Nyquist plot to this value.
16211628
Portions of the Nyquist plot whose magnitude is restricted are
1622-
plotted using a different line style.
1629+
plotted using a different line style. The default value is 20 and
1630+
can be set using config.defaults['nyquist.max_curve_magnitude'].
16231631
max_curve_offset : float, optional
16241632
When plotting scaled portion of the Nyquist plot, increase/decrease
16251633
the magnitude by this fraction of the max_curve_magnitude to allow
16261634
any overlaps between the primary and mirror curves to be avoided.
1635+
The default value is 0.02 and can be set using
1636+
config.defaults['nyquist.max_curve_magnitude'].
16271637
mirror_style : [str, str] or False
16281638
Linestyles for mirror image of the Nyquist curve. The first element
16291639
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
@@ -51,7 +51,8 @@ def nichols_plot(
5151
Passed to `matplotlib` as the format string for all lines in the plot.
5252
The `omega` parameter must be present (use omega=None if needed).
5353
grid : boolean, optional
54-
True if the plot should include a Nichols-chart grid. Default is True.
54+
True if the plot should include a Nichols-chart grid. Default is
55+
True and can be set using config.defaults['nichols.grid'].
5556
**kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
5657
Additional keywords passed to `matplotlib` to specify line properties.
5758

control/nlsys.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,9 +2320,10 @@ def interconnect(
23202320
23212321
states : int, list of str, or None, optional
23222322
Description of the system states. Same format as `inputs`. The
2323-
default is `None`, in which case the states will be given names of the
2324-
form '<subsys_name>.<state_name>', for each subsys in syslist and each
2325-
state_name of each subsys.
2323+
default is `None`, in which case the states will be given names of
2324+
the form '<subsys_name><delim><state_name>', for each subsys in
2325+
syslist and each state_name of each subsys, where <delim> is the
2326+
value of config.defaults['iosys.state_name_delim'].
23262327
23272328
params : dict, optional
23282329
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
@@ -383,6 +393,15 @@ def streamlines(
383393
384394
Other Parameters
385395
----------------
396+
arrows : int
397+
Set the number of arrows to plot along the streamlines. The default
398+
value can be set in config.defaults['phaseplot.arrows'].
399+
arrow_size : float
400+
Set the size of arrows to plot along the streamlines. The default
401+
value can be set in config.defaults['phaseplot.arrow_size'].
402+
arrow_style : matplotlib patch
403+
Set the style of arrows to plot along the streamlines. The default
404+
value can be set in config.defaults['phaseplot.arrow_style'].
386405
rcParams : dict
387406
Override the default parameters used for generating plots.
388407
Default is set by config.default['ctrlplot.rcParams'].
@@ -593,6 +612,13 @@ def separatrices(
593612
suppress_warnings : bool, optional
594613
If set to `True`, suppress warning messages in generating trajectories.
595614
615+
Notes
616+
-----
617+
The value of config.defaults['separatrices_radius'] is used to set the
618+
offset from the equlibrium point to the starting point of the separatix
619+
traces, in the direction of the eigenvectors evaluated at that
620+
equilibrium point.
621+
596622
"""
597623
# Process keywords
598624
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
@@ -31,7 +31,7 @@
3131

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

control/timeplot.py

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

0 commit comments

Comments
 (0)