Skip to content

Commit 555ba16

Browse files
committed
add numpydoc style testing + corrections
1 parent d366472 commit 555ba16

33 files changed

Lines changed: 473 additions & 413 deletions

control/bdalg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
def series(sys1, *sysn, **kwargs):
7373
r"""series(sys1, sys2, [..., sysn])
7474
75-
Return the series connection (`sysn` \* ...\ \*) `sys2` \* `sys1`.
75+
Return series connection (`sysn` \* ...\ \*) `sys2` \* `sys1`.
7676
7777
Parameters
7878
----------
@@ -144,7 +144,7 @@ def series(sys1, *sysn, **kwargs):
144144
def parallel(sys1, *sysn, **kwargs):
145145
r"""parallel(sys1, sys2, [..., sysn])
146146
147-
Return the parallel connection `sys1` + `sys2` (+ ...\ + `sysn`).
147+
Return parallel connection `sys1` + `sys2` (+ ...\ + `sysn`).
148148
149149
Parameters
150150
----------
@@ -440,9 +440,9 @@ def connect(sys, Q, inputv, outputv):
440440
values mean the feedback is negative. A zero value is ignored. Inputs
441441
and outputs are indexed starting at 1 to communicate sign information.
442442
inputv : 1D array
443-
list of final external inputs, indexed starting at 1
443+
List of final external inputs, indexed starting at 1.
444444
outputv : 1D array
445-
list of final external outputs, indexed starting at 1
445+
List of final external outputs, indexed starting at 1.
446446
447447
Returns
448448
-------
@@ -513,7 +513,7 @@ def connect(sys, Q, inputv, outputv):
513513
return Ytrim * sys * Utrim
514514

515515
def combine_tf(tf_array, **kwargs):
516-
"""Combine array-like of transfer functions into MIMO transfer function.
516+
"""Combine array of transfer functions into MIMO transfer function.
517517
518518
Parameters
519519
----------
@@ -640,7 +640,7 @@ def combine_tf(tf_array, **kwargs):
640640

641641

642642
def split_tf(transfer_function):
643-
"""Split MIMO transfer function into NumPy array of SISO transfer functions.
643+
"""Split MIMO transfer function into SISO transfer functions.
644644
645645
System and signal names for the array of SISO transfer functions are
646646
copied from the MIMO system.

control/canonical.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def canonical_form(xsys, form='reachable'):
2323
Parameters
2424
----------
2525
xsys : StateSpace object
26-
System to be transformed, with state 'x'
26+
System to be transformed, with state 'x'.
2727
form : str
2828
Canonical form for transformation. Chosen from:
2929
* 'reachable' - reachable canonical form
@@ -33,9 +33,9 @@ def canonical_form(xsys, form='reachable'):
3333
Returns
3434
-------
3535
zsys : StateSpace object
36-
System in desired canonical form, with state 'z'
36+
System in desired canonical form, with state 'z'.
3737
T : (M, M) real ndarray
38-
Coordinate transformation matrix, z = T * x
38+
Coordinate transformation matrix, z = T * x.
3939
4040
Examples
4141
--------
@@ -75,14 +75,14 @@ def reachable_form(xsys):
7575
Parameters
7676
----------
7777
xsys : StateSpace object
78-
System to be transformed, with state `x`
78+
System to be transformed, with state `x`.
7979
8080
Returns
8181
-------
8282
zsys : StateSpace object
83-
System in reachable canonical form, with state `z`
83+
System in reachable canonical form, with state `z`.
8484
T : (M, M) real ndarray
85-
Coordinate transformation: z = T * x
85+
Coordinate transformation: z = T * x.
8686
8787
Examples
8888
--------
@@ -138,14 +138,14 @@ def observable_form(xsys):
138138
Parameters
139139
----------
140140
xsys : StateSpace object
141-
System to be transformed, with state `x`
141+
System to be transformed, with state `x`.
142142
143143
Returns
144144
-------
145145
zsys : StateSpace object
146-
System in observable canonical form, with state `z`
146+
System in observable canonical form, with state `z`.
147147
T : (M, M) real ndarray
148-
Coordinate transformation: z = T * x
148+
Coordinate transformation: z = T * x.
149149
150150
Examples
151151
--------
@@ -190,27 +190,27 @@ def observable_form(xsys):
190190

191191

192192
def similarity_transform(xsys, T, timescale=1, inverse=False):
193-
"""Perform a similarity transformation, with option time rescaling.
193+
"""Similarity transformation, with option time rescaling.
194194
195195
Transform a linear state space system to a new state space representation
196196
z = T x, or x = T z, where T is an invertible matrix.
197197
198198
Parameters
199199
----------
200200
xsys : StateSpace object
201-
System to transform
201+
System to transform.
202202
T : (M, M) array_like
203203
The matrix `T` defines the new set of coordinates z = T x.
204204
timescale : float, optional
205-
If present, also rescale the time unit to tau = timescale * t
205+
If present, also rescale the time unit to tau = timescale * t.
206206
inverse : bool, optional
207207
If False (default), transform so z = T x. If True, transform
208208
so x = T z.
209209
210210
Returns
211211
-------
212212
zsys : StateSpace object
213-
System in transformed coordinates, with state 'z'
213+
System in transformed coordinates, with state 'z'.
214214
215215
216216
Examples
@@ -397,20 +397,20 @@ def bdschur(a, condmax=None, sort=None):
397397
Parameters
398398
----------
399399
a : (M, M) array_like
400-
Real matrix to decompose
400+
Real matrix to decompose.
401401
condmax : None or float, optional
402-
If None (default), use 1/sqrt(eps), which is approximately 1e8
402+
If None (default), use 1/sqrt(eps), which is approximately 1e8.
403403
sort : {None, 'continuous', 'discrete'}
404404
Block sorting; see below.
405405
406406
Returns
407407
-------
408408
amodal : (M, M) real ndarray
409-
Block-diagonal Schur decomposition of `a`
409+
Block-diagonal Schur decomposition of `a`.
410410
tmodal : (M, M) real ndarray
411-
Similarity transform relating `a` and `amodal`
411+
Similarity transform relating `a` and `amodal`.
412412
blksizes : (N,) int ndarray
413-
Array of Schur block sizes
413+
Array of Schur block sizes.
414414
415415
Notes
416416
-----
@@ -486,7 +486,7 @@ def modal_form(xsys, condmax=None, sort=False):
486486
Parameters
487487
----------
488488
xsys : StateSpace object
489-
System to be transformed, with state `x`
489+
System to be transformed, with state `x`.
490490
condmax : None or float, optional
491491
An upper bound on individual transformations. If None, use
492492
`bdschur` default.
@@ -497,9 +497,9 @@ def modal_form(xsys, condmax=None, sort=False):
497497
Returns
498498
-------
499499
zsys : StateSpace object
500-
System in modal canonical form, with state `z`
500+
System in modal canonical form, with state `z`.
501501
T : (M, M) ndarray
502-
Coordinate transformation: z = T * x
502+
Coordinate transformation: z = T * x.
503503
504504
Examples
505505
--------

control/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ def use_matlab_defaults():
265265

266266
# Set defaults to match FBS (Astrom and Murray)
267267
def use_fbs_defaults():
268-
"""Use `Feedback Systems <http://fbsbook.org>`_ (FBS) compatible settings.
268+
"""Use Feedback Systems (FBS) compatible settings.
269+
270+
The following conventions fomr `Feedback Systems <http://fbsbook.org>`_
271+
are used:
269272
270-
The following conventions are used:
271273
* Bode plots plot gain in powers of ten, phase in degrees,
272274
frequency in rad/sec, no grid
273275
* Nyquist plots use dashed lines for mirror image of Nyquist curve

control/ctrlplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def pole_zero_subplots(
281281
Returns
282282
-------
283283
ax_array : array
284-
2D array of axes
284+
2D array of axes.
285285
286286
"""
287287
from .grid import nogrid, sgrid, zgrid

control/ctrlutil.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def unwrap(angle, period=2*math.pi):
5555
Parameters
5656
----------
5757
angle : array_like
58-
Array of angles to be unwrapped
58+
Array of angles to be unwrapped.
5959
period : float, optional
60-
Period (defaults to `2*pi`)
60+
Period (defaults to `2*pi`).
6161
6262
Returns
6363
-------
6464
angle_out : array_like
65-
Output array, with jumps of period/2 eliminated
65+
Output array, with jumps of period/2 eliminated.
6666
6767
Examples
6868
--------
@@ -106,12 +106,12 @@ def db2mag(db):
106106
Parameters
107107
----------
108108
db : float or ndarray
109-
input value or array of values, given in decibels
109+
Input value or array of values, given in decibels.
110110
111111
Returns
112112
-------
113113
mag : float or ndarray
114-
corresponding magnitudes
114+
Corresponding magnitudes.
115115
116116
Examples
117117
--------
@@ -134,12 +134,12 @@ def mag2db(mag):
134134
Parameters
135135
----------
136136
mag : float or ndarray
137-
input magnitude or array of magnitudes
137+
Input magnitude or array of magnitudes.
138138
139139
Returns
140140
-------
141141
db : float or ndarray
142-
corresponding values in decibels
142+
Corresponding values in decibels.
143143
144144
Examples
145145
--------

control/delay.py

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,6 @@
55
# Author: Sawyer Fuller
66
# Date: 26 Aug 2010
77
#
8-
# This file contains functions for implementing time delays (currently
9-
# only the pade() function).
10-
#
11-
# Copyright (c) 2010 by California Institute of Technology
12-
# All rights reserved.
13-
#
14-
# Redistribution and use in source and binary forms, with or without
15-
# modification, are permitted provided that the following conditions
16-
# are met:
17-
#
18-
# 1. Redistributions of source code must retain the above copyright
19-
# notice, this list of conditions and the following disclaimer.
20-
#
21-
# 2. Redistributions in binary form must reproduce the above copyright
22-
# notice, this list of conditions and the following disclaimer in the
23-
# documentation and/or other materials provided with the distribution.
24-
#
25-
# 3. Neither the name of the California Institute of Technology nor
26-
# the names of its contributors may be used to endorse or promote
27-
# products derived from this software without specific prior
28-
# written permission.
29-
#
30-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33-
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALTECH
34-
# OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
37-
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38-
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
40-
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41-
# SUCH DAMAGE.
42-
#
43-
# $Id$
44-
458

469
__all__ = ['pade']
4710

@@ -54,9 +17,9 @@ def pade(T, n=1, numdeg=None):
5417
Parameters
5518
----------
5619
T : number
57-
time delay
20+
Time. delay
5821
n : positive integer
59-
degree of denominator of approximation
22+
Degree of denominator of approximation.
6023
numdeg : integer, or None (the default)
6124
If numdeg is `None`, numerator degree equals denominator degree.
6225
If numdeg >= 0, specifies degree of numerator.

control/descfcn.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _f(self, x):
7878

7979
def describing_function(
8080
F, A, num_points=100, zero_check=True, try_method=True):
81-
"""Numerically compute the describing function of a nonlinear function.
81+
"""Numerically compute describing function of a nonlinear function.
8282
8383
The describing function of a nonlinearity is given by magnitude and phase
8484
of the first harmonic of the function when evaluated along a sinusoidal
@@ -285,8 +285,8 @@ def describing_function_response(
285285
Parameters
286286
----------
287287
H : LTI system
288-
Linear time-invariant (LTI) system (state space, transfer function, or
289-
FRD)
288+
Linear time-invariant (LTI) system (state space, transfer function,
289+
or FRD).
290290
F : static nonlinear function
291291
A static nonlinearity, either a scalar function or a single-input,
292292
single-output, static input/output system.
@@ -391,7 +391,7 @@ def describing_function_plot(
391391
*sysdata, point_label="%5.2g @ %-5.2g", label=None, **kwargs):
392392
"""describing_function_plot(data, *args, **kwargs)
393393
394-
Plot a Nyquist plot with a describing function for a nonlinear system.
394+
Nyquist plot with describing function for a nonlinear system.
395395
396396
This function generates a Nyquist plot for a closed loop system
397397
consisting of a linear system with a static nonlinear function in the
@@ -413,8 +413,8 @@ def describing_function_plot(
413413
A describing function response data object created by
414414
:func:`~control.describing_function_response`.
415415
H : LTI system
416-
Linear time-invariant (LTI) system (state space, transfer function, or
417-
FRD)
416+
Linear time-invariant (LTI) system (state space, transfer function,
417+
or FRD).
418418
F : static nonlinear function
419419
A static nonlinearity, either a scalar function or a single-input,
420420
single-output, static input/output system.
@@ -427,7 +427,7 @@ def describing_function_plot(
427427
refine : bool, optional
428428
If True (default), refine the location of the intersection of the
429429
Nyquist curve for the linear system and the describing function to
430-
determine the intersection point
430+
determine the intersection point.
431431
label : str or array_like of str, optional
432432
If present, replace automatically generated label with the given label.
433433
point_label : str, optional
@@ -552,7 +552,7 @@ def _find_intersection(L1a, L1b, L2a, L2b):
552552

553553
# Saturation nonlinearity
554554
class saturation_nonlinearity(DescribingFunctionNonlinearity):
555-
"""Create saturation nonlinearity for use in describing function analysis.
555+
"""Saturation nonlinearity for describing function analysis.
556556
557557
This class creates a nonlinear function representing a saturation with
558558
given upper and lower bounds, including the describing function for the
@@ -614,7 +614,7 @@ def describing_function(self, A):
614614

615615
# Relay with hysteresis (FBS2e, Example 10.12)
616616
class relay_hysteresis_nonlinearity(DescribingFunctionNonlinearity):
617-
"""Relay w/ hysteresis nonlinearity for describing function analysis.
617+
"""Relay w/ hysteresis for describing function analysis.
618618
619619
This class creates a nonlinear function representing a a relay with
620620
symmetric upper and lower bounds of magnitude `b` and a hysteretic region

0 commit comments

Comments
 (0)