Skip to content

Commit 1ed8817

Browse files
committed
regularize dt keyword use and related annotations (see develop.rst)
1 parent 34f39dc commit 1ed8817

31 files changed

Lines changed: 223 additions & 178 deletions

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
@@ -497,7 +497,7 @@ def modal_form(xsys, condmax=None, sort=False):
497497
Parameters
498498
----------
499499
xsys : StateSpace object
500-
System to be transformed, with state ``x``.
500+
System to be transformed, with state x.
501501
condmax : None or float, optional
502502
An upper bound on individual transformations. If None, use
503503
`bdschur` default.
@@ -508,7 +508,7 @@ def modal_form(xsys, condmax=None, sort=False):
508508
Returns
509509
-------
510510
zsys : StateSpace object
511-
System in modal canonical form, with state ``z``.
511+
System in modal canonical form, with state z.
512512
T : (M, M) ndarray
513513
Coordinate transformation: z = T * x.
514514

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
@@ -185,12 +185,15 @@ def flatsys(*args, updfcn=None, outfcn=None, **kwargs):
185185
variety of forms:
186186
187187
``fs.flatsys(forward, reverse)``
188+
188189
Create a flat system with mapings to/from flat flag.
189190
190191
``fs.flatsys(forward, reverse, updfcn[, outfcn])``
192+
191193
Create a flat system that is also a nonlinear I/O system.
192194
193195
``fs.flatsys(linsys)``
196+
194197
Create a flat system from a linear (StateSpace) system.
195198
196199
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
@@ -63,9 +63,9 @@ class constructor, using the `frd` factory function, or
6363
frequency) and if a system is multi-input or multi-output, then the
6464
outputs are returned as a 2D array (indexed by output and
6565
frequency) or a 3D array (indexed by output, trace, and frequency).
66-
If ``squeeze=True``, access to the output response will remove
66+
If `squeeze` = True, access to the output response will remove
6767
single-dimensional entries from the shape of the inputs and outputs
68-
even if the system is not SISO. If ``squeeze=False``, the output is
68+
even if the system is not SISO. If `squeeze` = False, the output is
6969
returned as a 3D array (indexed by the output, input, and
7070
frequency) even if the system is SISO. The default value can be set
7171
using `config.defaults['control.squeeze_frequency_response']`.
@@ -105,10 +105,10 @@ class constructor, using the `frd` factory function, or
105105
If set to False, don't plot the magnitude or phase, respectively.
106106
return_magphase : bool, optional
107107
If True, then a frequency response data object will enumerate
108-
as a tuple of the form ``(mag, phase, omega)`` where where ``mag``
108+
as a tuple of the form ``(mag, phase, omega)`` where where `mag`
109109
is the magnitude (absolute value, not dB or log10) of the system
110-
frequency response, ``phase`` is the wrapped phase in radians of the
111-
system frequency response, and ``omega`` is the (sorted) frequencies
110+
frequency response, `phase` is the wrapped phase in radians of the
111+
system frequency response, and `omega` is the (sorted) frequencies
112112
at which the response was evaluated.
113113
114114
See Also
@@ -173,9 +173,9 @@ class constructor, using the `frd` factory function, or
173173
#: frequency) and if a system is multi-input or multi-output, then the
174174
#: outputs are returned as a 2D array (indexed by output and frequency)
175175
#: or a 3D array (indexed by output, trace, and frequency). If
176-
#: ``squeeze=True``, access to the output response will remove
176+
#: `squeeze` = True, access to the output response will remove
177177
#: single-dimensional entries from the shape of the inputs and outputs
178-
#: even if the system is not SISO. If ``squeeze=False``, the output is
178+
#: even if the system is not SISO. If `squeeze` = False, the output is
179179
#: returned as a 3D array (indexed by the output, input, and frequency)
180180
#: even if the system is SISO. The default value can be set using
181181
#: config.defaults['control.squeeze_frequency_response'].
@@ -636,9 +636,9 @@ def eval(self, omega, squeeze=None):
636636
omega : float or 1D array_like
637637
Frequencies in radians per second.
638638
squeeze : bool, optional
639-
If ``squeeze=True``, remove single-dimensional entries from
639+
If `squeeze` = True, remove single-dimensional entries from
640640
the shape of the output even if the system is not SISO. If
641-
``squeeze=False``, keep all indices (output, input and, if omega
641+
`squeeze` = False, keep all indices (output, input and, if omega
642642
is array_like, frequency) even if the system is SISO. The
643643
default value can be set using
644644
`config.defaults['control.squeeze_frequency_response']`.
@@ -707,19 +707,19 @@ def __call__(self, s=None, squeeze=None, return_magphase=None):
707707
processing (`squeeze`, `return_magphase`).
708708
709709
squeeze : bool, optional
710-
If ``squeeze=True``, remove single-dimensional entries from the
710+
If `squeeze` = True, remove single-dimensional entries from the
711711
shape of the output even if the system is not SISO. If
712-
``squeeze=False``, keep all indices (output, input and, if
712+
`squeeze` = False, keep all indices (output, input and, if
713713
omega is array_like, frequency) even if the system is SISO. The
714714
default value can be set using
715715
`config.defaults['control.squeeze_frequency_response']`.
716716
717717
return_magphase : bool, optional
718718
If True, then a frequency response data object will
719719
enumerate as a tuple of the form ``(mag, phase, omega)`` where
720-
where ``mag`` is the magnitude (absolute value, not dB or log10)
721-
of the system frequency response, ``phase`` is the wrapped phase
722-
in radians of the system frequency response, and ``omega`` is
720+
where `mag` is the magnitude (absolute value, not dB or log10)
721+
of the system frequency response, `phase` is the wrapped phase
722+
in radians of the system frequency response, and `omega` is
723723
the (sorted) frequencies at which the response was evaluated.
724724
725725
Returns
@@ -861,9 +861,9 @@ def plot(self, plot_type=None, *args, **kwargs):
861861
"""Plot the frequency response using Bode or singular values plot.
862862
863863
Plot the frequency response using either a standard Bode plot
864-
(``plot_type='bode'``, default) or a singular values plot
865-
(``plot_type='svplot'``). See `bode_plot` and
866-
`singular_values_plot` for more detailed descriptions.
864+
(plot_type='bode', default) or a singular values plot
865+
(plot_type='svplot'). See `bode_plot` and `singular_values_plot`
866+
for more detailed descriptions.
867867
868868
"""
869869
from .freqplot import bode_plot, singular_values_plot
@@ -994,10 +994,12 @@ def frd(*args, **kwargs):
994994
of a system. This factory function can be called in different ways:
995995
996996
``frd(response, omega)``
997+
997998
Create an frd model with the given response data, in the form of
998999
complex response vector, at matching frequencies `omega` [in rad/s].
9991000
10001001
``frd(sys, omega)``
1002+
10011003
Convert an LTI system into an frd model with data at frequencies
10021004
`omega`.
10031005

control/freqplot.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ def bode_plot(
243243
Starting with python-control version 0.10, `bode_plot` returns a
244244
`ControlPlot` object instead of magnitude, phase, and
245245
frequency. To recover the old behavior, call `bode_plot` with
246-
``plot=True``, which will force the legacy values (mag, phase, omega) to
246+
`plot` = True, which will force the legacy values (mag, phase, omega) to
247247
be returned (with a warning). To obtain just the frequency response of
248248
a system (or list of systems) without plotting, use the
249249
`frequency_response` command.
250250
251251
If a discrete time model is given, the frequency response is plotted
252252
along the upper branch of the unit circle, using the mapping ``z =
253-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and `dt`
254-
is the discrete timebase. If timebase not specified (``dt=True``),
253+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and `dt`
254+
is the discrete timebase. If timebase not specified (`dt` = True),
255255
`dt` is set to 1.
256256
257257
The default values for Bode plot configuration parameters can be reset
@@ -1251,9 +1251,9 @@ def nyquist_response(
12511251
-----
12521252
If a discrete time model is given, the frequency response is computed
12531253
along the upper branch of the unit circle, using the mapping ``z =
1254-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and
1254+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and
12551255
`dt` is the discrete timebase. If timebase not specified
1256-
(``dt=True``), `dt` is set to 1.
1256+
(`dt` = True), `dt` is set to 1.
12571257
12581258
If a continuous-time system contains poles on or near the imaginary
12591259
axis, a small indentation will be used to avoid the pole. The radius
@@ -1717,9 +1717,9 @@ def nyquist_plot(
17171717
-----
17181718
If a discrete time model is given, the frequency response is computed
17191719
along the upper branch of the unit circle, using the mapping ``z =
1720-
exp(1j * omega * dt)`` where `omega` ranges from 0 to ``pi/dt`` and
1720+
exp(1j * omega * dt)`` where `omega` ranges from 0 to pi/`dt` and
17211721
`dt` is the discrete timebase. If timebase not specified
1722-
(``dt=True``), `dt` is set to 1.
1722+
(`dt` = True), `dt` is set to 1.
17231723
17241724
If a continuous-time system contains poles on or near the imaginary
17251725
axis, a small indentation will be used to avoid the pole. The radius
@@ -2450,12 +2450,12 @@ def singular_values_plot(
24502450
24512451
Notes
24522452
-----
2453-
If ``plot=False``, the following legacy values are returned:
2454-
* mag : ndarray (or list of ndarray if len(data) > 1))
2453+
If `plot` = `False`, the following legacy values are returned:
2454+
* `mag` : ndarray (or list of ndarray if len(data) > 1))
24552455
Magnitude of the response (deprecated).
2456-
* phase : ndarray (or list of ndarray if len(data) > 1))
2456+
* `phase` : ndarray (or list of ndarray if len(data) > 1))
24572457
Phase in radians of the response (deprecated).
2458-
* omega : ndarray (or list of ndarray if len(data) > 1))
2458+
* `omega` : ndarray (or list of ndarray if len(data) > 1))
24592459
Frequency in rad/sec (deprecated).
24602460
24612461
"""

control/iosys.py

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

0 commit comments

Comments
 (0)