Skip to content

Commit a8d5ff9

Browse files
committed
add checks for backticks + class docstrings and fix up docstrings
1 parent 8864385 commit a8d5ff9

35 files changed

+473
-401
lines changed

control/bdalg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,10 @@ def _ensure_tf(arraylike_or_tf, dt=None):
666666
Array-like or transfer function.
667667
dt : None, True or float, optional
668668
System timebase. 0 (default) indicates continuous
669-
time, True indicates discrete time with unspecified sampling
669+
time, `True` indicates discrete time with unspecified sampling
670670
time, positive number is discrete time with specified
671-
sampling time, None indicates unspecified timebase (either
672-
continuous or discrete time). If None, timestep is not validated.
671+
sampling time, `None` indicates unspecified timebase (either
672+
continuous or discrete time). If `None`, timestep is not validated.
673673
674674
Returns
675675
-------

control/canonical.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def similarity_transform(xsys, T, timescale=1, inverse=False):
206206
timescale : float, optional
207207
If present, also rescale the time unit to tau = timescale * t.
208208
inverse : bool, optional
209-
If False (default), transform so z = T x. If True, transform
209+
If `False` (default), transform so z = T x. If `True`, transform
210210
so x = T z.
211211
212212
Returns
@@ -270,7 +270,7 @@ def _bdschur_defective(blksizes, eigvals):
270270
271271
Returns
272272
-------
273-
True iff Schur blocks are defective.
273+
`True` iff Schur blocks are defective.
274274
275275
blksizes, eigvals are the 3rd and 4th results returned by mb03rd.
276276
"""
@@ -404,7 +404,7 @@ def bdschur(a, condmax=None, sort=None):
404404
a : (M, M) array_like
405405
Real matrix to decompose.
406406
condmax : None or float, optional
407-
If None (default), use 1/sqrt(eps), which is approximately 1e8.
407+
If `None` (default), use 1/sqrt(eps), which is approximately 1e8.
408408
sort : {None, 'continuous', 'discrete'}
409409
Block sorting; see below.
410410
@@ -419,7 +419,7 @@ def bdschur(a, condmax=None, sort=None):
419419
420420
Notes
421421
-----
422-
If `sort` is None, the blocks are not sorted.
422+
If `sort` is `None`, the blocks are not sorted.
423423
424424
If `sort` is 'continuous', the blocks are sorted according to
425425
associated eigenvalues. The ordering is first by real part of
@@ -493,10 +493,10 @@ def modal_form(xsys, condmax=None, sort=False):
493493
xsys : StateSpace object
494494
System to be transformed, with state `x`.
495495
condmax : None or float, optional
496-
An upper bound on individual transformations. If None, use
496+
An upper bound on individual transformations. If `None`, use
497497
`bdschur` default.
498498
sort : bool, optional
499-
If False (default), Schur blocks will not be sorted. See `bdschur`
499+
If `False` (default), Schur blocks will not be sorted. See `bdschur`
500500
for sort order.
501501
502502
Returns

control/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ def _get_param(module, param, argval=None, defval=None, pop=False, last=False):
217217
`module.param` is used to determine the default value. Defaults to
218218
None.
219219
pop : bool, optional
220-
If True and if argval is a dict, then pop the remove the parameter
220+
If `True` and if argval is a dict, then pop the remove the parameter
221221
entry from the argval dict after retreiving it. This allows the use
222222
of a keyword argument list to be passed through to other functions
223223
internal to the function being called.
224224
last : bool, optional
225-
If True, check to make sure dictionary is empy after processing.
225+
If `True`, check to make sure dictionary is empy after processing.
226226
227227
"""
228228

control/ctrlplot.py

Lines changed: 3 additions & 3 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
"""
@@ -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/descfcn.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def describing_function(self, A):
5454
"describing function not implemented for this function")
5555

5656
def _isstatic(self):
57-
"""Return True if the function has no internal state (memoryless).
57+
"""Return `True` if the function has no internal state (memoryless).
5858
5959
This internal function is used to optimize numerical computation of
6060
the describing function. It can be set to `True` if the instance
@@ -289,9 +289,9 @@ def describing_function_response(
289289
omega : list, optional
290290
List of frequencies to be used for the linear system Nyquist curve.
291291
warn_nyquist : bool, optional
292-
Set to True to turn on warnings generated by `nyquist_plot` or False
293-
to turn off warnings. If not set (or set to None), warnings are
294-
turned off if omega is specified, otherwise they are turned on.
292+
Set to `True` to turn on warnings generated by `nyquist_plot` or
293+
`False` to turn off warnings. If not set (or set to `None`), warnings
294+
are turned off if omega is specified, otherwise they are turned on.
295295
refine : bool, optional
296296
If `True`, `scipy.optimize.minimize` to refine the estimate
297297
of the intersection of the frequency response and the describing
@@ -419,7 +419,7 @@ def describing_function_plot(
419419
curve. If not specified (or None), frequencies are computed
420420
automatically based on the properties of the linear system.
421421
refine : bool, optional
422-
If True (default), refine the location of the intersection of the
422+
If `True` (default), refine the location of the intersection of the
423423
Nyquist curve for the linear system and the describing function to
424424
determine the intersection point.
425425
label : str or array_like of str, optional
@@ -434,9 +434,9 @@ def describing_function_plot(
434434
title : str, optional
435435
Set the title of the plot. Defaults to plot type and system name(s).
436436
warn_nyquist : bool, optional
437-
Set to True to turn on warnings generated by `nyquist_plot` or False
438-
to turn off warnings. If not set (or set to None), warnings are
439-
turned off if omega is specified, otherwise they are turned on.
437+
Set to `True` to turn on warnings generated by `nyquist_plot` or
438+
`False` to turn off warnings. If not set (or set to `None`), warnings
439+
are turned off if omega is specified, otherwise they are turned on.
440440
**kwargs : `matplotlib.pyplot.plot` keyword properties, optional
441441
Additional keywords passed to `matplotlib` to specify line properties
442442
for Nyquist curve.
@@ -560,6 +560,11 @@ class saturation_nonlinearity(DescribingFunctionNonlinearity):
560560
functions will not have zero bias and hence care must be taken in using
561561
the nonlinearity for analysis.
562562
563+
Parameters
564+
----------
565+
lb, ub : float
566+
Upper and lower saturation bounds.
567+
563568
Examples
564569
--------
565570
>>> nl = ct.saturation_nonlinearity(5)
@@ -615,14 +620,21 @@ class relay_hysteresis_nonlinearity(DescribingFunctionNonlinearity):
615620
of width `c` (using the notation from [FBS2e](https://fbsbook.org),
616621
Example 10.12, including the describing function for the nonlinearity.
617622
The following call creates a nonlinear function suitable for describing
618-
function analysis:
623+
function analysis::
619624
620625
F = relay_hysteresis_nonlinearity(b, c)
621626
622627
The output of this function is `b` if `x > c` and `-b` if `x < -c`. For
623628
`-c <= x <= c`, the value depends on the branch of the hysteresis loop (as
624629
illustrated in Figure 10.20 of FBS2e).
625630
631+
Parameters
632+
----------
633+
b : float
634+
Hysteresis bound.
635+
c : float
636+
Width of hysteresis region.
637+
626638
Examples
627639
--------
628640
>>> nl = ct.relay_hysteresis_nonlinearity(1, 2)
@@ -683,7 +695,7 @@ class friction_backlash_nonlinearity(DescribingFunctionNonlinearity):
683695
This class creates a nonlinear function representing a friction-dominated
684696
backlash nonlinearity ,including the describing function for the
685697
nonlinearity. The following call creates a nonlinear function suitable
686-
for describing function analysis:
698+
for describing function analysis::
687699
688700
F = friction_backlash_nonlinearity(b)
689701
@@ -692,6 +704,11 @@ class friction_backlash_nonlinearity(DescribingFunctionNonlinearity):
692704
center, the output is unchanged. Otherwise, the output is given by the
693705
input shifted by `b/2`.
694706
707+
Parameters
708+
----------
709+
b : float
710+
Backlash amount.
711+
695712
Examples
696713
--------
697714
>>> nl = ct.friction_backlash_nonlinearity(2) # backlash of +/- 1

control/dtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None,
5656
config.defaults['iosys.sampled_system_name_suffix'], with the
5757
default being to add the suffix '$sampled'.
5858
copy_names : bool, Optional
59-
If True, copy the names of the input signals, output
59+
If `True`, copy the names of the input signals, output
6060
signals, and states to the sampled system.
6161
6262
Notes

control/flatsys/bspline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BSplineFamily(BasisFamily):
4040
derivatives that should match).
4141
4242
vars : None or int, optional
43-
The number of spline variables. If specified as None (default),
43+
The number of spline variables. If specified as `None` (default),
4444
then the spline basis describes a single variable, with no indexing.
4545
If the number of spine variables is > 0, then the spline basis is
4646
index using the `var` keyword.

control/flatsys/flatsys.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ def _flat_outfcn(self, t, x, u, params=None):
173173

174174

175175
def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
176-
"""Create a differentially flat I/O system.
176+
"""flatsys(forward, reverse[, updfcn, outfcn]) \
177+
flatsys(linsys)
178+
179+
Create a differentially flat I/O system.
177180
178181
The flatsys() function is used to create an input/output system object
179182
that also represents a differentially flat system. It can be used in a
@@ -231,7 +234,7 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
231234
Description of the system states. Same format as `inputs`.
232235
233236
dt : None, True or float, optional
234-
System timebase. None (default) indicates continuous time, True
237+
System timebase. `None` (default) indicates continuous time, `True`
235238
indicates discrete time with undefined sampling time, positive
236239
number is discrete time with specified sampling time.
237240
@@ -741,7 +744,7 @@ def solve_flat_ocp(
741744
2. The return data structure includes the following additional attributes:
742745
* success : bool indicating whether the optimization succeeded
743746
* cost : computed cost of the returned trajectory
744-
* message : message returned by optimization if success if False
747+
* message : message returned by optimization if success if `False`
745748
746749
3. A common failure in solving optimal control problem is that the
747750
default initial guess violates the constraints and the optimizer

control/flatsys/linflat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LinearFlatSystem(FlatSystem, StateSpace):
2222
Parameters
2323
----------
2424
linsys : StateSpace
25-
LTI StateSpace system to be converted
25+
LTI StateSpace system to be converted.
2626
inputs : int, list of str or None, optional
2727
Description of the system inputs. This can be given as an integer
2828
count or as a list of strings that name the individual signals.
@@ -36,16 +36,16 @@ class LinearFlatSystem(FlatSystem, StateSpace):
3636
states : int, list of str, or None, optional
3737
Description of the system states. Same format as `inputs`.
3838
dt : None, True or float, optional
39-
System timebase. None (default) indicates continuous
40-
time, True indicates discrete time with undefined sampling
39+
System timebase. `None` (default) indicates continuous
40+
time, `True` indicates discrete time with undefined sampling
4141
time, positive number is discrete time with specified
4242
sampling time.
4343
params : dict, optional
4444
Parameter values for the systems. Passed to the evaluation
4545
functions for the system as default values, overriding internal
4646
defaults.
4747
name : string, optional
48-
System name (used for specifying signals)
48+
System name (used for specifying signals).
4949
5050
"""
5151

control/flatsys/systraj.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class SystemTrajectory:
3434
For each flat output, the number of derivatives of the flat
3535
output used to define the trajectory. Defaults to an empty
3636
list.
37+
params : dict, optional
38+
Parameter values used for the trajectory.
3739
3840
"""
3941

@@ -109,19 +111,19 @@ def response(self, tlist, transpose=False, return_x=False, squeeze=None):
109111
List of times to evaluate the trajectory.
110112
111113
transpose : bool, optional
112-
If True, transpose all input and output arrays (for backward
114+
If `True`, transpose all input and output arrays (for backward
113115
compatibility with MATLAB and `scipy.signal.lsim`).
114116
Default value is False.
115117
116118
return_x : bool, optional
117-
If True, return the state vector when assigning to a tuple
119+
If `True`, return the state vector when assigning to a tuple
118120
(default = False). See `forced_response` for more details.
119121
120122
squeeze : bool, optional
121123
By default, if a system is single-input, single-output (SISO) then
122124
the output response is returned as a 1D array (indexed by time).
123-
If squeeze=True, remove single-dimensional entries from the shape
124-
of the output even if the system is not SISO. If squeeze=False,
125+
If squeeze=`True`, remove single-dimensional entries from the shape
126+
of the output even if the system is not SISO. If squeeze=`False`,
125127
keep the output as a 3D array (indexed by the output, input, and
126128
time) even if the system is SISO. The default value can be set
127129
using config.defaults['control.squeeze_time_response'].
@@ -135,8 +137,8 @@ def response(self, tlist, transpose=False, return_x=False, squeeze=None):
135137
* time (array): Time values of the output.
136138
137139
* outputs (array): Response of the system. If the system is SISO
138-
and squeeze is not True, the array is 1D (indexed by time). If
139-
the system is not SISO or `squeeze` is False, the array is 3D
140+
and squeeze is not `True`, the array is 1D (indexed by time). If
141+
the system is not SISO or `squeeze` is `False`, the array is 3D
140142
(indexed by the output, trace, and time).
141143
142144
* states (array): Time evolution of the state vector, represented

0 commit comments

Comments
 (0)