Skip to content

Commit bf2472f

Browse files
committed
DOC: move constructor docs from __init__ to class; remove attr docs
1 parent 695cdfc commit bf2472f

File tree

13 files changed

+222
-125
lines changed

13 files changed

+222
-125
lines changed

control/flatsys/basis.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ class BasisFamily:
4747
4848
:math:`z_i^{(q)}(t)` = basis.eval_deriv(self, i, j, t)
4949
50+
Parameters
51+
----------
52+
N : int
53+
Order of the basis set.
54+
5055
"""
5156
def __init__(self, N):
5257
"""Create a basis family of order N."""

control/flatsys/linflat.py

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,46 +42,53 @@
4242

4343

4444
class LinearFlatSystem(FlatSystem, LinearIOSystem):
45+
"""Base class for a linear, differentially flat system.
46+
47+
This class is used to create a differentially flat system representation
48+
from a linear system.
49+
50+
Parameters
51+
----------
52+
linsys : StateSpace
53+
LTI StateSpace system to be converted
54+
inputs : int, list of str or None, optional
55+
Description of the system inputs. This can be given as an integer
56+
count or as a list of strings that name the individual signals.
57+
If an integer count is specified, the names of the signal will be
58+
of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
59+
this parameter is not given or given as `None`, the relevant
60+
quantity will be determined when possible based on other
61+
information provided to functions using the system.
62+
outputs : int, list of str or None, optional
63+
Description of the system outputs. Same format as `inputs`.
64+
states : int, list of str, or None, optional
65+
Description of the system states. Same format as `inputs`.
66+
dt : None, True or float, optional
67+
System timebase. None (default) indicates continuous
68+
time, True indicates discrete time with undefined sampling
69+
time, positive number is discrete time with specified
70+
sampling time.
71+
params : dict, optional
72+
Parameter values for the systems. Passed to the evaluation
73+
functions for the system as default values, overriding internal
74+
defaults.
75+
name : string, optional
76+
System name (used for specifying signals)
77+
78+
Returns
79+
-------
80+
iosys : LinearFlatSystem
81+
Linear system represented as an flat input/output system
82+
83+
"""
84+
4585
def __init__(self, linsys, inputs=None, outputs=None, states=None,
4686
name=None):
4787
"""Define a flat system from a SISO LTI system.
4888
4989
Given a reachable, single-input/single-output, linear time-invariant
5090
system, create a differentially flat system representation.
5191
52-
Parameters
53-
----------
54-
linsys : StateSpace
55-
LTI StateSpace system to be converted
56-
inputs : int, list of str or None, optional
57-
Description of the system inputs. This can be given as an integer
58-
count or as a list of strings that name the individual signals.
59-
If an integer count is specified, the names of the signal will be
60-
of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
61-
this parameter is not given or given as `None`, the relevant
62-
quantity will be determined when possible based on other
63-
information provided to functions using the system.
64-
outputs : int, list of str or None, optional
65-
Description of the system outputs. Same format as `inputs`.
66-
states : int, list of str, or None, optional
67-
Description of the system states. Same format as `inputs`.
68-
dt : None, True or float, optional
69-
System timebase. None (default) indicates continuous
70-
time, True indicates discrete time with undefined sampling
71-
time, positive number is discrete time with specified
72-
sampling time.
73-
params : dict, optional
74-
Parameter values for the systems. Passed to the evaluation
75-
functions for the system as default values, overriding internal
76-
defaults.
77-
name : string, optional
78-
System name (used for specifying signals)
79-
80-
Returns
81-
-------
82-
iosys : LinearFlatSystem
83-
Linear system represented as an flat input/output system
84-
8592
"""
8693
# Make sure we can handle the system
8794
if (not control.isctime(linsys)):

control/frdata.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,29 @@ class FrequencyResponseData(LTI):
6464
The FrequencyResponseData (FRD) class is used to represent systems in
6565
frequency response data form.
6666
67+
Parameters
68+
----------
69+
d : 1D or 3D complex array_like
70+
The frequency response at each frequency point. If 1D, the system is
71+
assumed to be SISO. If 3D, the system is MIMO, with the first
72+
dimension corresponding to the output index of the FRD, the second
73+
dimension corresponding to the input index, and the 3rd dimension
74+
corresponding to the frequency points in omega
75+
w : iterable of real frequencies
76+
List of frequency points for which data are available.
77+
smooth : bool, optional
78+
If ``True``, create an interpoloation function that allows the
79+
frequency response to be computed at any frequency within the range of
80+
frquencies give in ``w``. If ``False`` (default), frequency response
81+
can only be obtained at the frequencies specified in ``w``.
82+
83+
Attributes
84+
----------
85+
ninputs, noutputs : int
86+
Number of input and output variables.
87+
88+
Notes
89+
-----
6790
The main data members are 'omega' and 'fresp', where `omega` is a 1D array
6891
with the frequency points of the response, and `fresp` is a 3D array, with
6992
the first dimension corresponding to the output index of the FRD, the

control/iosys.py

Lines changed: 45 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class for a set of subclasses that are used to implement specific
121121

122122
_idCounter = 0
123123

124-
def name_or_default(self, name=None):
124+
def _name_or_default(self, name=None):
125125
if name is None:
126126
name = "sys[{}]".format(InputOutputSystem._idCounter)
127127
InputOutputSystem._idCounter += 1
@@ -138,39 +138,6 @@ def __init__(self, inputs=None, outputs=None, states=None, params={},
138138
:class:`~control.LinearIOSystem`, :class:`~control.NonlinearIOSystem`,
139139
:class:`~control.InterconnectedSystem`.
140140
141-
Parameters
142-
----------
143-
inputs : int, list of str, or None
144-
Description of the system inputs. This can be given as an integer
145-
count or as a list of strings that name the individual signals.
146-
If an integer count is specified, the names of the signal will be
147-
of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
148-
this parameter is not given or given as `None`, the relevant
149-
quantity will be determined when possible based on other
150-
information provided to functions using the system.
151-
outputs : int, list of str, or None
152-
Description of the system outputs. Same format as `inputs`.
153-
states : int, list of str, or None
154-
Description of the system states. Same format as `inputs`.
155-
dt : None, True or float, optional
156-
System timebase. 0 (default) indicates continuous
157-
time, True indicates discrete time with unspecified sampling
158-
time, positive number is discrete time with specified
159-
sampling time, None indicates unspecified timebase (either
160-
continuous or discrete time).
161-
params : dict, optional
162-
Parameter values for the systems. Passed to the evaluation
163-
functions for the system as default values, overriding internal
164-
defaults.
165-
name : string, optional
166-
System name (used for specifying signals). If unspecified, a
167-
generic name <sys[id]> is generated with a unique integer id.
168-
169-
Returns
170-
-------
171-
InputOutputSystem
172-
Input/output system object
173-
174141
"""
175142
# Store the input arguments
176143

@@ -179,7 +146,7 @@ def __init__(self, inputs=None, outputs=None, states=None, params={},
179146
# timebase
180147
self.dt = kwargs.get('dt', config.defaults['control.default_dt'])
181148
# system name
182-
self.name = self.name_or_default(name)
149+
self.name = self._name_or_default(name)
183150

184151
# Parse and store the number of inputs, outputs, and states
185152
self.set_inputs(inputs)
@@ -686,7 +653,7 @@ def copy(self, newname=None):
686653
dup_prefix = config.defaults['iosys.duplicate_system_name_prefix']
687654
dup_suffix = config.defaults['iosys.duplicate_system_name_suffix']
688655
newsys = copy.copy(self)
689-
newsys.name = self.name_or_default(
656+
newsys.name = self._name_or_default(
690657
dup_prefix + self.name + dup_suffix if not newname else newname)
691658
return newsys
692659

@@ -697,49 +664,55 @@ class LinearIOSystem(InputOutputSystem, StateSpace):
697664
This class is used to implementat a system that is a linear state
698665
space system (defined by the StateSpace system object).
699666
667+
Parameters
668+
----------
669+
linsys : StateSpace
670+
LTI StateSpace system to be converted
671+
inputs : int, list of str or None, optional
672+
Description of the system inputs. This can be given as an integer
673+
count or as a list of strings that name the individual signals. If an
674+
integer count is specified, the names of the signal will be of the
675+
form `s[i]` (where `s` is one of `u`, `y`, or `x`). If this parameter
676+
is not given or given as `None`, the relevant quantity will be
677+
determined when possible based on other information provided to
678+
functions using the system.
679+
outputs : int, list of str or None, optional
680+
Description of the system outputs. Same format as `inputs`.
681+
states : int, list of str, or None, optional
682+
Description of the system states. Same format as `inputs`.
683+
dt : None, True or float, optional
684+
System timebase. 0 (default) indicates continuous time, True indicates
685+
discrete time with unspecified sampling time, positive number is
686+
discrete time with specified sampling time, None indicates unspecified
687+
timebase (either continuous or discrete time).
688+
params : dict, optional
689+
Parameter values for the systems. Passed to the evaluation functions
690+
for the system as default values, overriding internal defaults.
691+
name : string, optional
692+
System name (used for specifying signals). If unspecified, a
693+
generic name <sys[id]> is generated with a unique integer id.
694+
695+
Attributes
696+
----------
697+
ninputs, noutputs, nstates, dt, etc
698+
See :class:`InputOutputSystem` for inherited attributes.
699+
700+
A, B, C, D
701+
See :class:`~control.StateSpace` for inherited attributes.
702+
703+
Returns
704+
-------
705+
iosys : LinearIOSystem
706+
Linear system represented as an input/output system
707+
700708
"""
701709
def __init__(self, linsys, inputs=None, outputs=None, states=None,
702710
name=None, **kwargs):
703711
"""Create an I/O system from a state space linear system.
704712
705713
Converts a :class:`~control.StateSpace` system into an
706714
:class:`~control.InputOutputSystem` with the same inputs, outputs, and
707-
states. The new system can be a continuous or discrete time system
708-
709-
Parameters
710-
----------
711-
linsys : StateSpace
712-
LTI StateSpace system to be converted
713-
inputs : int, list of str or None, optional
714-
Description of the system inputs. This can be given as an integer
715-
count or as a list of strings that name the individual signals.
716-
If an integer count is specified, the names of the signal will be
717-
of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
718-
this parameter is not given or given as `None`, the relevant
719-
quantity will be determined when possible based on other
720-
information provided to functions using the system.
721-
outputs : int, list of str or None, optional
722-
Description of the system outputs. Same format as `inputs`.
723-
states : int, list of str, or None, optional
724-
Description of the system states. Same format as `inputs`.
725-
dt : None, True or float, optional
726-
System timebase. 0 (default) indicates continuous
727-
time, True indicates discrete time with unspecified sampling
728-
time, positive number is discrete time with specified
729-
sampling time, None indicates unspecified timebase (either
730-
continuous or discrete time).
731-
params : dict, optional
732-
Parameter values for the systems. Passed to the evaluation
733-
functions for the system as default values, overriding internal
734-
defaults.
735-
name : string, optional
736-
System name (used for specifying signals). If unspecified, a
737-
generic name <sys[id]> is generated with a unique integer id.
738-
739-
Returns
740-
-------
741-
iosys : LinearIOSystem
742-
Linear system represented as an input/output system
715+
states. The new system can be a continuous or discrete time system.
743716
744717
"""
745718
if not isinstance(linsys, StateSpace):

control/lti.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
class LTI:
2525
"""LTI is a parent class to linear time-invariant (LTI) system objects.
2626
27-
LTI is the parent to the StateSpace and TransferFunction child
28-
classes. It contains the number of inputs and outputs, and the
29-
timebase (dt) for the system.
27+
LTI is the parent to the StateSpace and TransferFunction child classes. It
28+
contains the number of inputs and outputs, and the timebase (dt) for the
29+
system. This function is not generally called directly by the user.
3030
31-
The timebase for the system, dt, is used to specify whether the
32-
system is operating in continuous or discrete time. It can have
33-
the following values:
31+
The timebase for the system, dt, is used to specify whether the system
32+
is operating in continuous or discrete time. It can have the following
33+
values:
3434
3535
* dt = None No timebase specified
3636
* dt = 0 Continuous time system

control/statesp.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _f2s(f):
160160
class StateSpace(LTI):
161161
"""StateSpace(A, B, C, D[, dt])
162162
163-
A class for representing state-space models
163+
A class for representing state-space models.
164164
165165
The StateSpace class is used to represent state-space realizations of
166166
linear time-invariant (LTI) systems:
@@ -170,13 +170,39 @@ class StateSpace(LTI):
170170
171171
where u is the input, y is the output, and x is the state.
172172
173-
The main data members are the A, B, C, and D matrices. The class also
174-
keeps track of the number of states (i.e., the size of A). The data
175-
format used to store state space matrices is set using the value of
176-
`config.defaults['use_numpy_matrix']`. If True (default), the state space
177-
elements are stored as `numpy.matrix` objects; otherwise they are
178-
`numpy.ndarray` objects. The :func:`~control.use_numpy_matrix` function
179-
can be used to set the storage type.
173+
Parameters
174+
----------
175+
A, B, C, D: array_like
176+
System matrices of the appropriate dimensions.
177+
dt : None, True or float, optional
178+
System timebase. 0 (default) indicates continuous
179+
time, True indicates discrete time with unspecified sampling
180+
time, positive number is discrete time with specified
181+
sampling time, None indicates unspecified timebase (either
182+
continuous or discrete time).
183+
184+
Attributes
185+
----------
186+
ninputs, noutputs, nstates : int
187+
Number of input, output and state variables.
188+
A, B, C, D : 2D arrays
189+
System matrices defining the input/output dynamics.
190+
dt : None, True or float
191+
System timebase. 0 (default) indicates continuous time, True indicates
192+
discrete time with unspecified sampling time, positive number is
193+
discrete time with specified sampling time, None indicates unspecified
194+
timebase (either continuous or discrete time).
195+
196+
Notes
197+
-----
198+
The main data members in the ``StateSpace`` class are the A, B, C, and D
199+
matrices. The class also keeps track of the number of states (i.e.,
200+
the size of A). The data format used to store state space matrices is
201+
set using the value of `config.defaults['use_numpy_matrix']`. If True
202+
(default), the state space elements are stored as `numpy.matrix` objects;
203+
otherwise they are `numpy.ndarray` objects. The
204+
:func:`~control.use_numpy_matrix` function can be used to set the storage
205+
type.
180206
181207
A discrete time system is created by specifying a nonzero 'timebase', dt
182208
when the system is constructed:

0 commit comments

Comments
 (0)