Skip to content

Commit bba4f58

Browse files
committed
add NamedSignal documentation + tweak control classes figure
1 parent 53e4c4d commit bba4f58

File tree

5 files changed

+53
-13
lines changed

5 files changed

+53
-13
lines changed

control/iosys.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ class NamedSignal(np.ndarray):
4646
This class modifies the `numpy.ndarray` class and allows signals to
4747
be accessed using the signal name in addition to indices and slices.
4848
49+
Signals can be either a 2D array, index by signal and time, or a 3D
50+
array, indexed by signal, trace, and time.
51+
52+
Attributes
53+
----------
54+
signal_labels : list of str
55+
Label names for each of the signal elements in the signal.
56+
trace_labels : list of str, optional
57+
Label names for each of the traces in the signal (if multi-trace).
58+
59+
Examples
60+
--------
61+
>>> sys = ct.rss(
62+
... states=['p1', 'p2', 'p3'], inputs=['u1', 'u2'], outputs=['y'])
63+
>>> resp = ct.step_response(sys)
64+
>>> resp.states['p1', 'u1'] # Step response from u1 to p1
65+
NamedSignal(...)
66+
4967
"""
5068
def __new__(cls, input_array, signal_labels=None, trace_labels=None):
5169
# See https://numpy.org/doc/stable/user/basics.subclassing.html
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
:no-members:
7+
:show-inheritance:
8+
:no-inherited-members:
9+
:no-special-members:

doc/classes.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ systems (both linear time-invariant and nonlinear). They are usually
1414
created from factory functions such as :func:`tf` and :func:`ss`, so the
1515
user should normally not need to instantiate these directly.
1616

17-
The following figure illustrates the relationship between the classes.
17+
The following figure illustrates the relationship between the classes:
1818

19-
.. image:: figures/classes.pdf
20-
:width: 800
19+
.. figure:: figures/classes.pdf
20+
:width: 480
2121
:align: center
2222

2323
.. autosummary::
@@ -34,6 +34,17 @@ The following figure illustrates the relationship between the classes.
3434
InterconnectedSystem
3535
LinearICSystem
3636

37+
The time response of an input/output system is represented using a
38+
special :class:`NamedSignal` class that allows the individual signal
39+
elements to be access using signal names in palce of integer offsets:
40+
41+
.. autosummary::
42+
:toctree: generated/
43+
:template: extended-class-template.rst
44+
:nosignatures:
45+
46+
NamedSignal
47+
3748

3849
Response and Plotting Classes
3950
=============================

doc/figures/classes.fig

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#FIG 3.2 Produced by xfig version 3.2.8b
1+
#FIG 3.2 Produced by xfig version 3.2.9
2+
#encoding: UTF-8
23
Landscape
34
Center
45
Inches
@@ -37,12 +38,13 @@ Single
3738
2 1 0 2 1 7 50 -1 -1 0.000 0 0 7 0 1 2
3839
1 0 1.00 60.00 90.00
3940
6525 1950 7050 2550
40-
4 1 1 50 -1 16 12 0.0000 4 210 2115 4050 3675 InterconnectedSystem\001
41-
4 1 1 50 -1 16 12 0.0000 4 165 1605 7950 3675 TransferFunction\001
42-
4 1 1 50 -1 0 12 0.0000 4 150 345 7050 2775 LTI\001
43-
4 1 1 50 -1 16 12 0.0000 4 210 1830 5175 2775 NonlinearIOSystem\001
44-
4 1 1 50 -1 16 12 0.0000 4 210 1095 6150 3675 StateSpace\001
45-
4 1 1 50 -1 16 12 0.0000 4 210 1500 5175 4575 LinearICSystem\001
46-
4 2 1 50 -1 16 12 0.0000 4 210 1035 3375 3225 FlatSystem\001
47-
4 0 1 50 -1 16 12 0.0000 4 165 420 8400 3225 FRD\001
48-
4 1 1 50 -1 16 12 0.0000 4 210 1770 6300 1875 InputOutputSystem\001
41+
4 1 1 50 -1 16 12 0.0000 4 191 1958 4050 3675 InterconnectedSystem\001
42+
4 1 1 50 -1 16 12 0.0000 4 151 1496 7950 3675 TransferFunction\001
43+
4 1 1 50 -1 0 12 0.0000 4 133 305 7050 2775 LTI\001
44+
4 1 1 50 -1 16 12 0.0000 4 191 1705 5175 2775 NonlinearIOSystem\001
45+
4 1 1 50 -1 16 12 0.0000 4 190 1016 6150 3675 StateSpace\001
46+
4 1 1 50 -1 16 12 0.0000 4 191 1394 5175 4575 LinearICSystem\001
47+
4 2 1 50 -1 16 12 0.0000 4 191 970 3375 3225 FlatSystem\001
48+
4 0 1 50 -1 16 12 0.0000 4 145 384 8400 3225 FRD\001
49+
4 1 1 50 -1 16 12 0.0000 4 191 1681 6300 1875 InputOutputSystem\001
50+
4 1 7 50 -1 16 12 0.0000 4 22 21 5175 4800 .\001

doc/figures/classes.pdf

221 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy