8000 Change Lti to LTI · XiangPiCha/python-control@a5bfafc · GitHub
[go: up one dir, main page]

Skip to content

Commit a5bfafc

Browse files
committed
Change Lti to LTI
This change is just cosmetic, and shouldn't affect any user code, since the Lti base class is not exposed to the user. (Well, technically it is exposed to the user, but it isn't in the `control` namespace, isn't used in any tests, and probably shouldn't be exposed to the user.)
1 parent 20bd90a commit a5bfafc

File tree

15 files changed

+66
-88
lines changed

15 files changed

+66
-88
lines changed

control/ctrlutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def unwrap(angle, period=2*pi):
7979

8080
def issys(obj):
8181
"""Return True if an object is a system, otherwise False"""
82-
return isinstance(obj, lti.Lti)
82+
return isinstance(obj, lti.LTI)
8383

8484
def db2mag(db):
8585
"""Convert a gain in decibels (dB) to a magnitude

control/frdata.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@
7878
from numpy import angle, array, empty, ones, \
7979
real, imag, matrix, absolute, eye, linalg, where, dot
8080
from scipy.interpolate import splprep, splev
81-
from .lti import Lti
81+
from .lti import LTI
8282

83-
class FRD(Lti):
83+
class FRD(LTI):
8484
"""The FRD class represents (measured?) frequency response
8585
TF instances and functions.
8686
87-
The FRD class is derived from the Lti parent class. It is used
87+
The FRD class is derived from the LTI parent class. It is used
8888
throughout the python-control library to represent systems in frequency
8989
response data form.
9090
@@ -118,7 +118,7 @@ def __init__(self, *args, **kwargs):
118118
To call the copy constructor, call FRD(sys), where sys is a
119119
FRD object.
120120
121-
To construct frequency response data for an existing Lti
121+
To construct frequency response data for an existing LTI
122122
object, other than an FRD, call FRD(sys, omega)
123123
124124
@@ -127,7 +127,7 @@ def __init__(self, *args, **kwargs):
127127
smooth = kwargs.get('smooth', False)
128128

129129
if len(args) == 2:
130-
if not isinstance(args[0], FRD) and isinstance(args[0], Lti):
130+
if not isinstance(args[0], FRD) and isinstance(args[0], LTI):
131131
# not an FRD, but still a system, second argument should be
132132
# the frequency range
133133
otherlti = args[0]
@@ -179,7 +179,7 @@ def __init__(self, *args, **kwargs):
179179
w=1.0/(absolute(self.fresp[i, j, :])+0.001), s=0.0)
180180
else:
181181
self.ifunc = None
182-
Lti.__init__(self, self.fresp.shape[1], self.fresp.shape[0])
182+
LTI.__init__(self, self.fresp.shape[1], self.fresp.shape[0])
183183

184184
def __str__(self):
185185
"""String representation of the transfer function."""
@@ -437,7 +437,7 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1):
437437
438438
If sys is already an frd, and its frequency range matches or
439439
overlaps the range given in omega then it is returned. If sys is
440-
another Lti object or a transfer function, then it is converted to
440+
another LTI object or a transfer function, then it is converted to
441441
a frequency response data at the specified omega. If sys is a
442442
scalar, then the number of inputs and outputs can be specified
443443
manually, as in:
@@ -459,7 +459,7 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1):
459459
raise NotImplementedError(
460460
"Frequency ranges of FRD do not match, conversion not implemented")
461461

462-
elif isinstance(sys, Lti):
462+
elif isinstance(sys, LTI):
463463
omega.sort()
464464
fresp = empty((sys.outputs, sys.inputs, len(omega)), dtype=complex)
465465
for k, w in enumerate(omega):

control/freqplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def nyquist_plot(syslist, omega=None, Plot=True, color='b',
184184
185185
Parameters
186186
----------
187-
syslist : list of Lti
187+
syslist : list of LTI
188188
List of linear input/output systems (single system is OK)
189189
omega : freq_range
190190
Range of frequencies (list or bounds) in rad/sec
@@ -281,7 +281,7 @@ def gangof4_plot(P, C, omega=None):
281281
282282
Parameters
283283
----------
284-
P, C : Lti
284+
P, C : LTI
285285
Linear input/output systems (process and control)
286286
omega : array
287287
Range of frequencies (list or bounds) in rad/sec
@@ -344,7 +344,7 @@ def default_frequency_range(syslist):
344344
345345
Parameters
346346
----------
347-
syslist : list of Lti
347+
syslist : list of LTI
348348
List of linear input/output systems (single system is OK)
349349
350350
Returns

control/lti.py

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""lti.py
22
3-
The Lti module contains the Lti parent class to the child classes StateSpace
3+
The lti module contains the LTI parent class to the child classes StateSpace
44
and TransferFunction. It is designed for use in the python-control library.
55
66
Routines in this module:
77
8-
Lti.__init__
8+
LTI.__init__
99
isdtime()
1010
isctime()
1111
timebase()
@@ -14,10 +14,10 @@
1414

1515
from numpy import absolute, real
1616

17-
class Lti:
18-
"""Lti is a parent class to linear time invariant control (LTI) objects.
17+
class LTI:
18+
"""LTI is a parent class to linear time-invariant (LTI) system objects.
1919
20-
Lti is the parent to the StateSpace and TransferFunction child
20+
LTI is the parent to the StateSpace and TransferFunction child
2121
classes. It contains the number of inputs and outputs, and the
2222
timebase (dt) for the system.
2323
@@ -30,32 +30,10 @@ class Lti:
3030
* dt > 0 Discrete time system with sampling time dt
3131
* dt = True Discrete time system with unspecified sampling time
3232
33-
When to Lti systems are combined, there timebases much match. A system
33+
When two LTI systems are combined, their timebases much match. A system
3434
with timebase None can be combined with a system having a specified
3535
timebase, and the result will have the timebase of the latter system.
3636
37-
The StateSpace and TransferFunction child classes contain several common
38-
"virtual" functions. These are:
39-
40-
__init__
41-
copy
42-
__str__
43-
__neg__
44-
__add__
45-
__radd__
46-
__sub__
47-
__rsub__
48-
__mul__
49-
__rmul__
50-
__div__
51-
__rdiv__
52-
evalfr
53-
freqresp
54-
pole
55-
zero
56-
feedback
57-
returnScipySignalLti
58-
5937
"""
6038

6139
def __init__(self, inputs=1, outputs=1, dt=None):
@@ -112,25 +90,25 @@ def damp(self):
11290
def issiso(sys, strict=False):
11391
if isinstance(sys, (int, float, complex)) and not strict:
11492
return True
115-
elif not isinstance(sys, Lti):
116-
raise ValueError("Object is not an Lti system")
93+
elif not isinstance(sys, LTI):
94+
raise ValueError("Object is not an LTI system")
11795

11896
# Done with the tricky stuff...
11997
return sys.issiso()
12098

12199
# Return the timebase (with conversion if unspecified)
122100
def timebase(sys, strict=True):
123-
"""Return the timebase for an Lti system
101+
"""Return the timebase for an LTI system
124102
125103
dt = timebase(sys)
126104
127105
returns the timebase for a system 'sys'. If the strict option is
128106
set to False, dt = True will be returned as 1.
129107
"""
130-
# System needs to be either a constant or an Lti system
108+
# System needs to be either a constant or an LTI system
131109
if isinstance(sys, (int, float, complex)):
132110
return None
133-
elif not isinstance(sys, Lti):
111+
elif not isinstance(sys, LTI):
134112
raise ValueError("Timebase not defined")
135113

136114
# Return the sample time, with converstion to float if strict is false
@@ -181,7 +159,7 @@ def isdtime(sys, strict=False):
181159
return True if not strict else False
182160

183161
# Check for a transfer function or state-space object
184-
if isinstance(sys, Lti):
162+
if isinstance(sys, LTI):
185163
return sys.isdtime(strict)
186164

187165
# Got passed something we don't recognize
@@ -206,7 +184,7 @@ def isctime(sys, strict=False):
206184
return True if not strict else False
207185

208186
# Check for a transfer function or state space object
209-
if isinstance(sys, Lti):
187+
if isinstance(sys, LTI):
210188
return sys.isctime(strict)
211189

212190
# Got passed something we don't recognize

control/margins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _polysqr(pol):
7474

7575
# Took the framework for the old function by
7676
# Sawyer B. Fuller <minster@caltech.edu>, removed a lot of the innards
77-
# and replaced with analytical polynomial functions for Lti systems.
77+
# and replaced with analytical polynomial functions for LTI systems.
7878
#
7979
# idea for the frequency data solution copied/adapted from
8080
# https://github.com/alchemyst/Skogestad-Python/blob/master/BODE.py

control/matlab.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
from . import margins
8989
from .statesp import StateSpace, _rss_generate, _convertToStateSpace
9090
from .xferfcn import TransferFunction, _convertToTransferFunction
91-
from .lti import Lti # base class of StateSpace, TransferFunction
91+
from .lti import LTI # base class of StateSpace, TransferFunction
9292
from .lti import issiso
9393
from .frdata import FRD
9494
from .dtime import sample_system
@@ -513,7 +513,7 @@ def tf(*args):
513513
514514
Parameters
515515
----------
516-
sys: Lti (StateSpace or TransferFunction)
516+
sys: LTI (StateSpace or TransferFunction)
517517
A linear system
518518
num: array_like, or list of list of array_like
519519
Polynomial coefficients of the numerator
@@ -597,7 +597,7 @@ def frd(*args):
597597
complex response vector, at matching frequency freqs [in rad/s]
598598
599599
``frd(sys, freqs)``
600-
Convert an Lti system into an frd model with data at frequencies
600+
Convert an LTI system into an frd model with data at frequencies
601601
freqs.
602602
603603
Parameters
@@ -606,7 +606,7 @@ def frd(*args):
606606
complex vector with the system response
607607
freq: array_lik or lis
608608
vector with frequencies
609-
sys: Lti (StateSpace or TransferFunction)
609+
sys: LTI (StateSpace or TransferFunction)
610610
A linear system
611611
612612
Returns
@@ -714,7 +714,7 @@ def tf2ss(*args):
714714
715715
Parameters
716716
----------
717-
sys: Lti (StateSpace or TransferFunction)
717+
sys: LTI (StateSpace or TransferFunction)
718718
A linear system
719719
num: array_like, or list of list of array_like
720720
Polynomial coefficients of the numerator
@@ -1008,7 +1008,7 @@ def bode(*args, **keywords):
10081008
10091009
Parameters
10101010
----------
1011-
sys : Lti, or list of Lti
1011+
sys : LTI, or list of LTI
10121012
System for which the Bode response is plotted and give. Optionally
10131013
a list of systems can be entered, or several systems can be
10141014
specified (i.e. several parameters). The sys arguments may also be
@@ -1190,7 +1190,7 @@ def dcgain(*args):
11901190
A linear system in zero, pole, gain form.
11911191
num, den: array-like
11921192
A linear system in transfer function form.
1193-
sys: Lti (StateSpace or TransferFunction)
1193+
sys: LTI (StateSpace or TransferFunction)
11941194
A linear system object.
11951195
11961196
Returns
@@ -1238,7 +1238,7 @@ def damp(sys, doprint=True):
12381238
12391239
Parameters
12401240
----------
1241-
sys: Lti (StateSpace or TransferFunction)
1241+
sys: LTI (StateSpace or TransferFunction)
12421242
A linear system object
12431243
doprint:
12441244
if true, print table with values
@@ -1421,7 +1421,7 @@ def lsim(sys, U=0., T=None, X0=0.):
14211421
14221422
Parameters
14231423
----------
1424-
sys: Lti (StateSpace, or TransferFunction)
1424+
sys: LTI (StateSpace, or TransferFunction)
14251425
LTI system to simulate
14261426
14271427
U: array-like or number, optional
@@ -1464,7 +1464,7 @@ def ssdata(sys):
14641464
14651465
Parameters
14661466
----------
1467-
sys: Lti (StateSpace, or TransferFunction)
1467+
sys: LTI (StateSpace, or TransferFunction)
14681468
LTI system whose data will be returned
14691469
14701470
Returns
@@ -1482,7 +1482,7 @@ def tfdata(sys):
14821482
14831483
Parameters
14841484
----------
1485-
sys: Lti (StateSpace, or TransferFunction)
1485+
sys: LTI (StateSpace, or TransferFunction)
14861486
LTI system whose data will be returned
14871487
14881488
Returns
@@ -1501,7 +1501,7 @@ def c2d(sysc, Ts, method='zoh'):
15011501
15021502
Parameters
15031503
----------
1504-
sysc: Lti (StateSpace or TransferFunction), continuous
1504+
sysc: LTI (StateSpace or TransferFunction), continuous
15051505
System to be converted
15061506
15071507
Ts: number

control/nichols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def nichols_plot(syslist, omega=None, grid=True):
5353
5454
Parameters
5555
----------
56-
syslist : list of Lti, or Lti
56+
syslist : list of LTI, or LTI
5757
List of linear input/output systems (single system is OK)
5858
omega : array_like
5959
Range of frequencies (list or bounds) in rad/sec

control/pzmap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#import scipy as sp
4545
#import numpy as np
4646
from numpy import real, imag
47-
from .lti import Lti
47+
from .lti import LTI
4848

4949
# TODO: Implement more elegant cross-style axes. See:
5050
# http://matplotlib.sourceforge.net/examples/axes_grid/demo_axisline_style.html
@@ -55,7 +55,7 @@ def pzmap(sys, Plot=True, title='Pole Zero Map'):
5555
5656
Parameters
5757
----------
58-
sys: Lti (StateSpace or TransferFunction)
58+
sys: LTI (StateSpace or TransferFunction)
5959
Linear system for which poles and zeros are computed.
6060
Plot: bool
6161
If ``True`` a graph is generated with Matplotlib,
@@ -68,7 +68,7 @@ def pzmap(sys, Plot=True, title='Pole Zero Map'):
6868
zeros: array
6969
The system's zeros.
7070
"""
71-
if not isinstance(sys, Lti):
71+
if not isinstance(sys, LTI):
7272
raise TypeError('Argument ``sys``: must be a linear system.')
7373

7474
poles = sys.pole()

control/rlocus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# or a control.TransferFunction object.
4141
# * Added some comments to make sure I understand the code
4242
#
43-
# RMM, 2 April 2011: modified to work with new Lti structure (see ChangeLog)
43+
# RMM, 2 April 2011: modified to work with new LTI structure (see ChangeLog)
4444
# * Not tested: should still work on signal.ltisys objects
4545
#
4646
# $Id$

control/statefbk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ def lqr(*args, **keywords):
156156
* ``lqr(A, B, Q, R)``
157157
* ``lqr(A, B, Q, R, N)``
158158
159-
where `sys` is an `Lti` object, and `A`, `B`, `Q`, `R`, and `N` are
159+
where `sys` is an `LTI` object, and `A`, `B`, `Q`, `R`, and `N` are
160160
2d arrays or matrices of appropriate dimension.
161161
162162
Parameters
163163
----------
164164
A, B: 2-d array
165165
Dynamics and input matrices
166-
sys: Lti (StateSpace or TransferFunction)
166+
sys: LTI (StateSpace or TransferFunction)
167167
Linear I/O system
168168
Q, R: 2-d array
169169
State and input weight matrices

0 commit comments

Comments
 (0)
0