Skip to content

Commit d198286

Browse files
committed
regularize dt keyword use and related annotations (see develop.rst)
1 parent b3f33be commit d198286

31 files changed

+223
-178
lines changed

control/bdalg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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` or if `sys1.dt` is
62+
not compatible with `sys2.dt`.
6363
6464
See Also
6565
--------
@@ -72,8 +72,8 @@ def series(*sys, **kwargs):
7272
system class. The output type is the type of `sys1` unless a more
7373
general type is required based on type type of `sys2`.
7474
75-
If both systems have a defined timebase (dt = 0 for continuous time,
76-
dt > 0 for discrete time), then the timebase for both systems must
75+
If both systems have a defined timebase (`dt` = 0 for continuous time,
76+
`dt` > 0 for discrete time), then the timebase for both systems must
7777
match. If only one of the system has a timebase, the return
7878
timebase will be set to match it.
7979
@@ -143,8 +143,8 @@ def parallel(*sys, **kwargs):
143143
the type of `sys1`. If `sys1` is a scalar, then the output type is
144144
the type of `sys2`.
145145
146-
If both systems have a defined timebase (dt = 0 for continuous time,
147-
dt > 0 for discrete time), then the timebase for both systems must
146+
If both systems have a defined timebase (`dt` = 0 for continuous time,
147+
`dt` > 0 for discrete time), then the timebase for both systems must
148148
match. If only one of the system has a timebase, the return
149149
timebase will be set to match it.
150150

control/canonical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def modal_form(xsys, condmax=None, sort=False):
498498
Parameters
499499
----------
500500
xsys : StateSpace object
501-
System to be transformed, with state ``x``.
501+
System to be transformed, with state x.
502502
condmax : None or float, optional
503503
An upper bound on individual transformations. If None, use
504504
`bdschur` default.
@@ -509,7 +509,7 @@ def modal_form(xsys, condmax=None, sort=False):
509509
Returns
510510
-------
511511
zsys : StateSpace object
512-
System in modal canonical form, with state ``z``.
512+
System in modal canonical form, with state z.
513513
T : (M, M) ndarray
514514
Coordinate transformation: z = T * x.
515515

control/ctrlplot.py

Lines changed: 1 addition & 1 deletion
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
"""

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/descfcn.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,9 @@ class relay_hysteresis_nonlinearity(DescribingFunctionNonlinearity):
626626
627627
F = relay_hysteresis_nonlinearity(b, c)
628628
629-
The output of this function is ``b`` if ``x > c`` and ``-b`` if ``x <
630-
-c``. For ``-c <= x <= c``, the value depends on the branch of the
631-
hysteresis loop (as illustrated in Figure 10.20 of FBS2e).
629+
The output of this function is b if x > c and -b if x < -c. For -c <=
630+
x <= c, the value depends on the branch of the hysteresis loop (as
631+
illustrated in Figure 10.20 of FBS2e).
632632
633633
Parameters
634634
----------
@@ -702,9 +702,9 @@ class friction_backlash_nonlinearity(DescribingFunctionNonlinearity):
702702
F = friction_backlash_nonlinearity(b)
703703
704704
This function maintains an internal state representing the 'center' of
705-
a mechanism with backlash. If the new input is within ``b/2`` of the
705+
a mechanism with backlash. If the new input is within b/2 of the
706706
current center, the output is unchanged. Otherwise, the output is
707-
given by the input shifted by ``b/2``.
707+
given by the input shifted by b/2.
708708
709709
Parameters
710710
----------

control/flatsys/flatsys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,15 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
184184
variety of forms:
185185
186186
``fs.flatsys(forward, reverse)``
187+
187188
Create a flat system with mapings to/from flat flag.
188189
189190
``fs.flatsys(forward, reverse, updfcn[, outfcn])``
191+
190192
Create a flat system that is also a nonlinear I/O system.
191193
192194
``fs.flatsys(linsys)``
195+
193196
Create a flat system from a linear (StateSpace) system.
194197
195198
Parameters

control/flatsys/systraj.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def response(self, tlist, transpose=False, return_x=False, squeeze=None):
122122
squeeze : bool, optional
123123
By default, if a system is single-input, single-output (SISO)
124124
then the output response is returned as a 1D array (indexed by
125-
time). If ``squeeze=True`, remove single-dimensional entries
125+
time). If `squeeze` = True, remove single-dimensional entries
126126
from the shape of the output even if the system is not SISO. If
127-
``squeeze=False``, keep the output as a 3D array (indexed by
127+
`squeeze` = False, keep the output as a 3D array (indexed by
128128
the output, input, and time) even if the system is SISO. The
129129
default value can be set using
130130
`config.defaults['control.squeeze_time_response']`.

control/frdata.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ class constructor, using the `frd` factory function, or
6464
frequency) and if a system is multi-input or multi-output, then the
6565
outputs are returned as a 2D array (indexed by output and
6666
frequency) or a 3D array (indexed by output, trace, and frequency).
67-
If ``squeeze=True``, access to the output response will remove
67+
If `squeeze` = True, access to the output response will remove
6868
single-dimensional entries from the shape of the inputs and outputs
69-
even if the system is not SISO. If ``squeeze=False``, the output is
69+
even if the system is not SISO. If `squeeze` = False, the output is
7070
returned as a 3D array (indexed by the output, input, and
7171
frequency) even if the system is SISO. The default value can be set
7272
using `config.defaults['control.squeeze_frequency_response']`.
@@ -106,10 +106,10 @@ class constructor, using the `frd` factory function, or
106106
If set to False, don't plot the magnitude or phase, respectively.
107107
return_magphase : bool, optional
108108
If True, then a frequency response data object will enumerate
109-
as a tuple of the form ``(mag, phase, omega)`` where where ``mag``
109+
as a tuple of the form ``(mag, phase, omega)`` where where `mag`
110110
is the magnitude (absolute value, not dB or log10) of the system
111-
frequency response, ``phase`` is the wrapped phase in radians of the
112-
system frequency response, and ``omega`` is the (sorted) frequencies
111+
frequency response, `phase` is the wrapped phase in radians of the
112+
system frequency response, and `omega` is the (sorted) frequencies
113113
at which the response was evaluated.
114114
115115
See Also
@@ -174,9 +174,9 @@ class constructor, using the `frd` factory function, or
174174
#: frequency) and if a system is multi-input or multi-output, then the
175175
#: outputs are returned as a 2D array (indexed by output and frequency)
176176
#: or a 3D array (indexed by output, trace, and frequency). If
177-
#: ``squeeze=True``, access to the output response will remove
177+
#: `squeeze` = True, access to the output response will remove
178178
#: single-dimensional entries from the shape of the inputs and outputs
179-
#: even if the system is not SISO. If ``squeeze=False``, the output is
179+
#: even if the system is not SISO. If `squeeze` = False, the output is
180180
#: returned as a 3D array (indexed by the output, input, and frequency)
181181
#: even if the system is SISO. The default value can be set using
182182
#: config.defaults['control.squeeze_frequency_response'].
@@ -623,9 +623,9 @@ def eval(self, omega, squeeze=None):
623623
omega : float or 1D array_like
624624
Frequencies in radians per second.
625625
squeeze : bool, optional
626-
If ``squeeze=True``, remove single-dimensional entries from
626+
If `squeeze` = True, remove single-dimensional entries from
627627
the shape of the output even if the system is not SISO. If
628-
``squeeze=False``, keep all indices (output, input and, if omega
628+
`squeeze` = False, keep all indices (output, input and, if omega
629629
is array_like, frequency) even if the system is SISO. The
630630
default value can be set using
631631
`config.defaults['control.squeeze_frequency_response']`.
@@ -694,19 +694,19 @@ def __call__(self, s=None, squeeze=None, return_magphase=None):
694694
processing (`squeeze`, `return_magphase`).
695695
696696
squeeze : bool, optional
697-
If ``squeeze=True``, remove single-dimensional entries from the
697+
If `squeeze` = True, remove single-dimensional entries from the
698698
shape of the output even if the system is not SISO. If
699-
``squeeze=False``, keep all indices (output, input and, if
699+
`squeeze` = False, keep all indices (output, input and, if
700700
omega is array_like, frequency) even if the system is SISO. The
701701
default value can be set using
702702
`config.defaults['control.squeeze_frequency_response']`.
703703
704704
return_magphase : bool, optional
705705
If True, then a frequency response data object will
706706
enumerate as a tuple of the form ``(mag, phase, omega)`` where
707-
where ``mag`` is the magnitude (absolute value, not dB or log10)
708-
of the system frequency response, ``phase`` is the wrapped phase
709-
in radians of the system frequency response, and ``omega`` is
707+
where `mag` is the magnitude (absolute value, not dB or log10)
708+
of the system frequency response, `phase` is the wrapped phase
709+
in radians of the system frequency response, and `omega` is
710710
the (sorted) frequencies at which the response was evaluated.
711711
712712
Returns
@@ -828,9 +828,9 @@ def plot(self, plot_type=None, *args, **kwargs):
828828
"""Plot the frequency response using Bode or singular values plot.
829829
830830
Plot the frequency response using either a standard Bode plot
831-
(``plot_type='bode'``, default) or a singular values plot
832-
(``plot_type='svplot'``). See `bode_plot` and
833-
`singular_values_plot` for more detailed descriptions.
831+
(plot_type='bode', default) or a singular values plot
832+
(plot_type='svplot'). See `bode_plot` and `singular_values_plot`
833+
for more detailed descriptions.
834834
835835
"""
836836
from .freqplot import bode_plot, singular_values_plot
@@ -961,10 +961,12 @@ def frd(*args, **kwargs):
961961
of a system. This factory function can be called in different ways:
962962
963963
``frd(response, omega)``
964+
964965
Create an frd model with the given response data, in the form of
965966
complex response vector, at matching frequencies `omega` [in rad/s].
966967
967968
``frd(sys, omega)``
969+
968970
Convert an LTI system into an frd model with data at frequencies
969971
`omega`.
970972

control/freqplot.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ def bode_plot(
244244
Starting with python-control version 0.10, `bode_plot` returns a
245245
`ControlPlot` object instead of magnitude, phase, and
246246
frequency. To recover the old behavior, call `bode_plot` with
247-
``plot=True``, which will force the legacy values (mag, phase, omega) to
247+
`plot` = True, which will force the legacy values (mag, phase, omega) to
248248
be returned (with a warning). To obtain just the frequency response of
249249
a system (or list of systems) without plotting, use the
250250
`frequency_response` command.
251251
252252
If a discrete time model is given, the frequency response is plotted
253253
along the upper branch of the unit circle, using the mapping ``z =
254-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and `dt`
255-
is the discrete timebase. If timebase not specified (``dt=True``),
254+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and `dt`
255+
is the discrete timebase. If timebase not specified (`dt` = True),
256256
`dt` is set to 1.
257257
258258
The default values for Bode plot configuration parameters can be reset
@@ -1254,9 +1254,9 @@ def nyquist_response(
12541254
-----
12551255
If a discrete time model is given, the frequency response is computed
12561256
along the upper branch of the unit circle, using the mapping ``z =
1257-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and
1257+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and
12581258
`dt` is the discrete timebase. If timebase not specified
1259-
(``dt=True``), `dt` is set to 1.
1259+
(`dt` = True), `dt` is set to 1.
12601260
12611261
If a continuous-time system contains poles on or near the imaginary
12621262
axis, a small indentation will be used to avoid the pole. The radius
@@ -1707,9 +1707,9 @@ def nyquist_plot(
17071707
-----
17081708
If a discrete time model is given, the frequency response is computed
17091709
along the upper branch of the unit circle, using the mapping ``z =
1710-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and
1710+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and
17111711
`dt` is the discrete timebase. If timebase not specified
1712-
(``dt=True``), `dt` is set to 1.
1712+
(`dt` = True), `dt` is set to 1.
17131713
17141714
If a continuous-time system contains poles on or near the imaginary
17151715
axis, a small indentation will be used to avoid the pole. The radius
@@ -2441,12 +2441,12 @@ def singular_values_plot(
24412441
24422442
Notes
24432443
-----
2444-
If ``plot=False``, the following legacy values are returned:
2445-
* mag : ndarray (or list of ndarray if len(data) > 1))
2444+
If `plot` = `False`, the following legacy values are returned:
2445+
* `mag` : ndarray (or list of ndarray if len(data) > 1))
24462446
Magnitude of the response (deprecated).
2447-
* phase : ndarray (or list of ndarray if len(data) > 1))
2447+
* `phase` : ndarray (or list of ndarray if len(data) > 1))
24482448
Phase in radians of the response (deprecated).
2449-
* omega : ndarray (or list of ndarray if len(data) > 1))
2449+
* `omega` : ndarray (or list of ndarray if len(data) > 1))
24502450
Frequency in rad/sec (deprecated).
24512451
24522452
"""

control/iosys.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ class InputOutputSystem():
116116
is operating in continuous or discrete time. It can have the following
117117
values:
118118
119-
* ``dt = None`` No timebase specified
120-
* ``dt = 0`` Continuous time system
121-
* ``dt > 0`` Discrete time system with sampling time dt
122-
* ``dt = True`` Discrete time system with unspecified sampling time
119+
* `dt` = None: No timebase specified
120+
* `dt` = 0: Continuous time system
121+
* `dt` > 0: Discrete time system with sampling time dt
122+
* `dt` = True: Discrete time system with unspecified sampling time
123123
124124
Parameters
125125
----------
@@ -673,15 +673,15 @@ def timebase(sys, strict=True):
673673
dt = timebase(sys)
674674
675675
returns the timebase for a system 'sys'. If the strict option is
676-
set to True, ``dt = True`` will be returned as 1.
676+
set to True, `dt` = True will be returned as 1.
677677
678678
Parameters
679679
----------
680680
sys : InputOutputSystem or float
681681
System whose timebase is to be determined.
682682
strict : bool, optional
683683
Whether to implement strict checking. If set to True (default),
684-
a float will always be returned (``dt = True`` will be returned as 1).
684+
a float will always be returned (`dt` = True will be returned as 1).
685685
686686
Returns
687687
-------

0 commit comments

Comments
 (0)