Skip to content

Commit 681b2b3

Browse files
committed
update backtick guidelines, docstrings, CSS processing
1 parent 1cfe93f commit 681b2b3

Some content is hidden

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

56 files changed

+1586
-1417
lines changed

control/bdalg.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ def series(*sys, **kwargs):
4545
----------------
4646
inputs, outputs : str, or list of str, optional
4747
List of strings that name the individual signals. If not given,
48-
signal names will be of the form `s[i]` (where `s` is one of `u`,
49-
or `y`). See `InputOutputSystem` for more information.
48+
signal names will be of the form 's[i]' (where 's' is one of 'u,
49+
or 'y'). See `InputOutputSystem` for more information.
5050
states : str, or list of str, optional
5151
List of names for system states. If not given, state names will be
52-
of of the form `x[i]` for interconnections of linear systems or
52+
of the form 'x[i]' for interconnections of linear systems or
5353
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
5454
name : string, optional
5555
System name (used for specifying signals). If unspecified, a generic
@@ -58,8 +58,8 @@ def series(*sys, **kwargs):
5858
Raises
5959
------
6060
ValueError
61-
if `sys2.ninputs` does not equal `sys1.noutputs`
62-
if `sys1.dt` is not compatible with `sys2.dt`
61+
if ``sys2.ninputs`` does not equal ``sys1.noutputs``
62+
if ``sys1.dt`` is not compatible with ``sys2.dt``
6363
6464
See Also
6565
--------
@@ -116,11 +116,11 @@ def parallel(*sys, **kwargs):
116116
----------------
117117
inputs, outputs : str, or list of str, optional
118118
List of strings that name the individual signals. If not given,
119-
signal names will be of the form `s[i]` (where `s` is one of `u`,
120-
or `y`). See `InputOutputSystem` for more information.
119+
signal names will be of the form 's[i'` (where 's' is one of 'u',
120+
or 'y'). See `InputOutputSystem` for more information.
121121
states : str, or list of str, optional
122122
List of names for system states. If not given, state names will be
123-
of the form `x[i]` for interconnections of linear systems or
123+
of the form 'x[i]' for interconnections of linear systems or
124124
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
125125
name : string, optional
126126
System name (used for specifying signals). If unspecified, a generic
@@ -129,7 +129,8 @@ def parallel(*sys, **kwargs):
129129
Raises
130130
------
131131
ValueError
132-
if `sys1` and `sys2` do not have the same numbers of inputs and outputs
132+
If `sys1` and `sys2` do not have the same numbers of inputs and
133+
outputs.
133134
134135
See Also
135136
--------
@@ -184,11 +185,11 @@ def negate(sys, **kwargs):
184185
----------------
185186
inputs, outputs : str, or list of str, optional
186187
List of strings that name the individual signals. If not given,
187-
signal names will be of the form `s[i]` (where `s` is one of `u`,
188-
or `y`). See `InputOutputSystem` for more information.
188+
signal names will be of the form 's[i]' (where 's' is one of 'u',
189+
or 'y'). See `InputOutputSystem` for more information.
189190
states : str, or list of str, optional
190191
List of names for system states. If not given, state names will be
191-
of of the form `x[i]` for interconnections of linear systems or
192+
of of the form 'x[i]' for interconnections of linear systems or
192193
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
193194
name : string, optional
194195
System name (used for specifying signals). If unspecified, a generic
@@ -226,10 +227,9 @@ def feedback(sys1, sys2=1, sign=-1, **kwargs):
226227
----------
227228
sys1, sys2 : scalar, array, or `InputOutputSystem`
228229
I/O systems to combine.
229-
sign : scalar
230-
The sign of feedback. `sign` = -1 indicates negative feedback, and
231-
`sign` = 1 indicates positive feedback. `sign` is an optional
232-
argument; it assumes a value of -1 if not specified.
230+
sign : scalar, optional
231+
The sign of feedback. `sign=-1` indicates negative feedback
232+
(default), and `sign=1` indicates positive feedback.
233233
234234
Returns
235235
-------
@@ -240,11 +240,11 @@ def feedback(sys1, sys2=1, sign=-1, **kwargs):
240240
----------------
241241
inputs, outputs : str, or list of str, optional
242242
List of strings that name the individual signals. If not given,
243-
signal names will be of the form `s[i]` (where `s` is one of `u`,
244-
or `y`). See `InputOutputSystem` for more information.
243+
signal names will be of the form 's[i]' (where 's' is one of 'u',
244+
or 'y'). See `InputOutputSystem` for more information.
245245
states : str, or list of str, optional
246246
List of names for system states. If not given, state names will be
247-
of of the form `x[i]` for interconnections of linear systems or
247+
of of the form 'x[i]' for interconnections of linear systems or
248248
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
249249
name : string, optional
250250
System name (used for specifying signals). If unspecified, a generic
@@ -326,11 +326,11 @@ def append(*sys, **kwargs):
326326
----------------
327327
inputs, outputs : str, or list of str, optional
328328
List of strings that name the individual signals. If not given,
329-
signal names will be of the form `s[i]` (where `s` is one of `u`,
330-
or `y`). See `InputOutputSystem` for more information.
329+
signal names will be of the form 's[i]' (where 's' is one of 'u',
330+
or 'y'). See `InputOutputSystem` for more information.
331331
states : str, or list of str, optional
332332
List of names for system states. If not given, state names will be
333-
of of the form `x[i]` for interconnections of linear systems or
333+
of of the form 'x[i]' for interconnections of linear systems or
334334
'<subsys_name>.<state_name>' for interconnected nonlinear systems.
335335
name : string, optional
336336
System name (used for specifying signals). If unspecified, a generic
@@ -472,10 +472,10 @@ def combine_tf(tf_array, **kwargs):
472472
Parameters
473473
----------
474474
tf_array : list of list of TransferFunction or array_like
475-
Transfer matrix represented as a two-dimensional array or list-of-lists
476-
containing TransferFunction objects. The TransferFunction objects can
477-
have multiple outputs and inputs, as long as the dimensions are
478-
compatible.
475+
Transfer matrix represented as a two-dimensional array or
476+
list-of-lists containing TransferFunction objects. The
477+
`TransferFunction` objects can have multiple outputs and inputs, as
478+
long as the dimensions are compatible.
479479
480480
Returns
481481
-------
@@ -486,8 +486,8 @@ def combine_tf(tf_array, **kwargs):
486486
----------------
487487
inputs, outputs : str, or list of str, optional
488488
List of strings that name the individual signals. If not given,
489-
signal names will be of the form `s[i]` (where `s` is one of `u`,
490-
or `y`). See `InputOutputSystem` for more information.
489+
signal names will be of the form 's[i]' (where 's' is one of 'u',
490+
or 'y'). See `InputOutputSystem` for more information.
491491
name : string, optional
492492
System name (used for specifying signals). If unspecified, a generic
493493
name <sys[id]> is generated with a unique integer id.
@@ -534,6 +534,7 @@ def combine_tf(tf_array, **kwargs):
534534
[array([1.]), array([1.]), array([1.])],
535535
[array([1.]), array([1.]), array([1, 0])]],
536536
name='G', outputs=3, inputs=3)
537+
537538
"""
538539
# Find common timebase or raise error
539540
dt_list = []
@@ -663,10 +664,10 @@ def _ensure_tf(arraylike_or_tf, dt=None):
663664
Array-like or transfer function.
664665
dt : None, True or float, optional
665666
System timebase. 0 (default) indicates continuous
666-
time, `True` indicates discrete time with unspecified sampling
667+
time, True indicates discrete time with unspecified sampling
667668
time, positive number is discrete time with specified
668-
sampling time, `None` indicates unspecified timebase (either
669-
continuous or discrete time). If `None`, timestep is not validated.
669+
sampling time, None indicates unspecified timebase (either
670+
continuous or discrete time). If None, timestep is not validated.
670671
671672
Returns
672673
-------

control/canonical.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
from .statefbk import ctrb, obsv
1717
from .statesp import StateSpace, _convert_to_statespace
1818

19-
__all__ = ['canonical_form', 'reachable_form', 'observable_form', 'modal_form',
20-
'similarity_transform', 'bdschur']
19+
__all__ = ['canonical_form', 'reachable_form', 'observable_form',
20+
'modal_form', 'similarity_transform', 'bdschur']
2121

2222

2323
def canonical_form(xsys, form='reachable'):
@@ -127,10 +127,12 @@ def reachable_form(xsys):
127127
# Check to make sure inversion was OK. Note that since we are inverting
128128
# Wrx and we already checked its rank, this exception should never occur
129129
if matrix_rank(Tzx) != xsys.nstates: # pragma: no cover
130-
raise ValueError("Transformation matrix singular to working precision.")
130+
raise ValueError(
131+
"Transformation matrix singular to working precision.")
131132

132133
# Finally, compute the output matrix
133-
zsys.C = solve(Tzx.T, xsys.C.T).T # matrix right division, zsys.C = xsys.C * inv(Tzx)
134+
# matrix right division, zsys.C = xsys.C * inv(Tzx)
135+
zsys.C = solve(Tzx.T, xsys.C.T).T
134136

135137
return zsys, Tzx
136138

@@ -184,7 +186,8 @@ def observable_form(xsys):
184186
Tzx = solve(Wrz, Wrx) # matrix left division, Tzx = inv(Wrz) * Wrx
185187

186188
if matrix_rank(Tzx) != xsys.nstates:
187-
raise ValueError("Transformation matrix singular to working precision.")
189+
raise ValueError(
190+
"Transformation matrix singular to working precision.")
188191

189192
# Finally, compute the output matrix
190193
zsys.B = Tzx @ xsys.B
@@ -207,7 +210,7 @@ def similarity_transform(xsys, T, timescale=1, inverse=False):
207210
timescale : float, optional
208211
If present, also rescale the time unit to tau = timescale * t.
209212
inverse : bool, optional
210-
If `False` (default), transform so z = T x. If `True`, transform
213+
If False (default), transform so z = T x. If True, transform
211214
so x = T z.
212215
213216
Returns
@@ -271,7 +274,7 @@ def _bdschur_defective(blksizes, eigvals):
271274
272275
Returns
273276
-------
274-
`True` iff Schur blocks are defective.
277+
True iff Schur blocks are defective.
275278
276279
blksizes, eigvals are the 3rd and 4th results returned by mb03rd.
277280
"""
@@ -394,7 +397,9 @@ def _bdschur_condmax_search(aschur, tschur, condmax):
394397
# hit search limit
395398
return reslower
396399
else:
397-
raise ValueError('bisection failed to converge; pmaxlower={}, pmaxupper={}'.format(pmaxlower, pmaxupper))
400+
raise ValueError(
401+
"bisection failed to converge; "
402+
"pmaxlower={}, pmaxupper={}".format(pmaxlower, pmaxupper))
398403

399404

400405
def bdschur(a, condmax=None, sort=None):
@@ -405,7 +410,7 @@ def bdschur(a, condmax=None, sort=None):
405410
a : (M, M) array_like
406411
Real matrix to decompose.
407412
condmax : None or float, optional
408-
If `None` (default), use 1/sqrt(eps), which is approximately 1e8.
413+
If None (default), use 1/sqrt(eps), which is approximately 1e8.
409414
sort : {None, 'continuous', 'discrete'}
410415
Block sorting; see below.
411416
@@ -420,7 +425,7 @@ def bdschur(a, condmax=None, sort=None):
420425
421426
Notes
422427
-----
423-
If `sort` is `None`, the blocks are not sorted.
428+
If `sort` is None, the blocks are not sorted.
424429
425430
If `sort` is 'continuous', the blocks are sorted according to
426431
associated eigenvalues. The ordering is first by real part of
@@ -444,7 +449,8 @@ def bdschur(a, condmax=None, sort=None):
444449
condmax = np.finfo(np.float64).eps ** -0.5
445450

446451
if not (np.isscalar(condmax) and condmax >= 1.0):
447-
raise ValueError('condmax="{}" must be a scalar >= 1.0'.format(condmax))
452+
raise ValueError(
453+
'condmax="{}" must be a scalar >= 1.0'.format(condmax))
448454

449455
a = np.atleast_2d(a)
450456
if a.shape[0] == 0 or a.shape[1] == 0:
@@ -492,18 +498,18 @@ def modal_form(xsys, condmax=None, sort=False):
492498
Parameters
493499
----------
494500
xsys : StateSpace object
495-
System to be transformed, with state `x`.
501+
System to be transformed, with state ``x``.
496502
condmax : None or float, optional
497-
An upper bound on individual transformations. If `None`, use
503+
An upper bound on individual transformations. If None, use
498504
`bdschur` default.
499505
sort : bool, optional
500-
If `False` (default), Schur blocks will not be sorted. See `bdschur`
506+
If False (default), Schur blocks will not be sorted. See `bdschur`
501507
for sort order.
502508
503509
Returns
504510
-------
505511
zsys : StateSpace object
506-
System in modal canonical form, with state `z`.
512+
System in modal canonical form, with state ``z``.
507513
T : (M, M) ndarray
508514
Coordinate transformation: z = T * x.
509515

control/config.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def set_defaults(module, **keywords):
133133
defaults[module + '.' + key] = val
134134

135135

136+
# TODO: allow individual modules and individaul parameters to be reset
136137
def reset_defaults():
137138
"""Reset configuration values to their default (initial) values.
138139
@@ -199,7 +200,7 @@ def _get_param(module, param, argval=None, defval=None, pop=False, last=False):
199200
parameter for a module based on the default parameter settings and any
200201
arguments passed to the function. The precedence order for parameters is
201202
the value passed to the function (as a keyword), the value from the
202-
config.defaults dictionary, and the default value `defval`.
203+
`config.defaults` dictionary, and the default value `defval`.
203204
204205
Parameters
205206
----------
@@ -214,15 +215,15 @@ def _get_param(module, param, argval=None, defval=None, pop=False, last=False):
214215
defval : object
215216
Default value of the parameter to use, if it is not located in the
216217
`config.defaults` dictionary. If a dictionary is provided, then
217-
`module.param` is used to determine the default value. Defaults to
218+
'module.param' is used to determine the default value. Defaults to
218219
None.
219220
pop : bool, optional
220-
If `True` and if argval is a dict, then pop the remove the parameter
221+
If True and if argval is a dict, then pop the remove the parameter
221222
entry from the argval dict after retreiving it. This allows the use
222223
of a keyword argument list to be passed through to other functions
223224
internal to the function being called.
224225
last : bool, optional
225-
If `True`, check to make sure dictionary is empy after processing.
226+
If True, check to make sure dictionary is empy after processing.
226227
227228
"""
228229

@@ -395,7 +396,7 @@ def _process_legacy_keyword(kwargs, oldkey, newkey, newval, warn_oldkey=True):
395396
newval : object
396397
Value of the current parameter (from the function signature).
397398
warn_oldkey : bool
398-
If set to `False`, suppress generation of a warning about using a
399+
If set to False, suppress generation of a warning about using a
399400
legacy keyword. This is useful if you have two versions of a
400401
keyword and you want to allow either to be used (see the `cost` and
401402
`trajectory_cost` keywords in `flatsys.point_to_point` for an

control/ctrlplot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class ControlPlot():
148148
Figure on which the Axes are drawn.
149149
legend : `matplotlib:.legend.Legend` (instance or ndarray)
150150
Legend object(s) for the plot. If more than one legend is
151-
included, this will be an array with each entry being either` None`
151+
included, this will be an array with each entry being either`` None``
152152
(for no legend) or a legend object.
153153
154154
"""
@@ -194,7 +194,7 @@ def set_plot_title(self, title, frame='axes'):
194194
fig : Figure, optional
195195
Matplotlib figure. Defaults to current figure.
196196
frame : str, optional
197-
Coordinate frame to use for centering: 'axes' (default) or 'figure'.
197+
Coordinate frame for centering: 'axes' (default) or 'figure'.
198198
**kwargs : `matplotlib.pyplot.suptitle` keywords, optional
199199
Additional keywords (passed to matplotlib).
200200
@@ -282,7 +282,7 @@ def pole_zero_subplots(
282282
Figure to use for creating subplots.
283283
rcParams : dict
284284
Override the default parameters used for generating plots.
285-
Default is set by config.defaults['ctrlplot.rcParams'].
285+
Default is set by `config.defaults['ctrlplot.rcParams']`.
286286
287287
Returns
288288
-------
@@ -350,7 +350,7 @@ def _process_ax_keyword(
350350
created with axes of the desired shape.
351351
352352
If `create_axes` is False and a new/empty figure is returned, then axs
353-
is an array of the proper shape but `None` for each element. This allows
353+
is an array of the proper shape but None for each element. This allows
354354
the calling function to do the actual axis creation (needed for
355355
curvilinear grids that use the AxisArtist module).
356356
@@ -735,7 +735,7 @@ def _get_color(
735735
Returns
736736
-------
737737
color : matplotlib color spec
738-
Color to use for this line (or `None` for matplotlib default).
738+
Color to use for this line (or None for matplotlib default).
739739
740740
"""
741741
# See if the color was explicitly specified by the user

control/ctrlutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def unwrap(angle, period=2*math.pi):
2424
angle : array_like
2525
Array of angles to be unwrapped.
2626
period : float, optional
27-
Period (defaults to `2*pi`).
27+
Period (defaults to ``2*pi``).
2828
2929
Returns
3030
-------

control/delay.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
__all__ = ['pade']
99

1010
def pade(T, n=1, numdeg=None):
11-
"""
12-
Create a linear system that approximates a delay.
11+
"""Create a linear system that approximates a delay.
1312
14-
Return the numerator and denominator coefficients of the Pade approximation.
13+
Return the numerator and denominator coefficients of the Pade
14+
approximation of the given order.
1515
1616
Parameters
1717
----------
@@ -20,7 +20,7 @@ def pade(T, n=1, numdeg=None):
2020
n : positive integer
2121
Degree of denominator of approximation.
2222
numdeg : integer, or None (the default)
23-
If numdeg is `None`, numerator degree equals denominator degree.
23+
If numdeg is None, numerator degree equals denominator degree.
2424
If numdeg >= 0, specifies degree of numerator.
2525
If numdeg < 0, numerator degree is n+numdeg.
2626

0 commit comments

Comments
 (0)