8000 added keyword arguments to xferfcn.tf and statesp.ss to set dt · python-control/python-control@e3a0070 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3a0070

Browse files
sawyerbfullerbnavigator
authored andcommitted
added keyword arguments to xferfcn.tf and statesp.ss to set dt
1 parent 351e0f7 commit e3a0070

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

control/statesp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def __init__(self, *args, **kwargs):
240240
elif len(args) == 5:
241241
dt = args[4]
242242
if 'dt' in kwargs:
243-
warn('received multiple dt arguments, using positional arg'%dt)
243+
warn('received multiple dt arguments, using positional arg dt=%s'%dt)
244244
elif len(args) == 1:
245245
try:
246246
dt = args[0].dt
@@ -1290,7 +1290,7 @@ def _mimo2simo(sys, input, warn_conversion=False):
12901290

12911291
return sys
12921292

1293-
def ss(*args):
1293+
def ss(*args, **kwargs):
12941294
"""ss(A, B, C, D[, dt])
12951295
12961296
Create a state space system.
@@ -1366,7 +1366,7 @@ def ss(*args):
13661366
"""
13671367

13681368
if len(args) == 4 or len(args) == 5:
1369-
return StateSpace(*args)
1369+
return StateSpace(*args, **kwargs)
13701370
elif len(args) == 1:
13711371
from .xferfcn import TransferFunction
13721372
sys = args[0]
@@ -1378,7 +1378,7 @@ def ss(*args):
13781378
raise TypeError("ss(sys): sys must be a StateSpace or \
13791379
TransferFunction object. It is %s." % type(sys))
13801380
else:
1381-
raise ValueError("Needs 1 or 4 arguments; received %i." % len(args))
1381+
raise ValueError("Needs 1, 4, or 5 arguments; received %i." % len(args))
13821382

13831383

13841384
def tf2ss(*args):

control/xferfcn.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def __init__(self, *args, **kwargs):
218218
elif len(args) == 3:
219219
# Discrete time transfer function
220220
if 'dt' in kwargs:
221-
warn('received multiple dt arguments, using positional arg'%dt)
221+
warn('received multiple dt arguments, using positional arg dt=%s'%dt)
222222
elif len(args) == 1:
223223
# TODO: not sure this can ever happen since dt is always present
224224
try:
@@ -1322,7 +1322,7 @@ def _convert_to_transfer_function(sys, **kw):
13221322
raise TypeError("Can't convert given type to TransferFunction system.")
13231323

13241324

1325-
def tf(*args):
1325+
def tf(*args, **kwargs):
13261326
"""tf(num, den[, dt])
13271327
13281328
Create a transfer function system. Can create MIMO systems.
@@ -1412,7 +1412,7 @@ def tf(*args):
14121412
"""
14131413

14141414
if len(args) == 2 or len(args) == 3:
1415-
return TransferFunction(*args)
1415+
return TransferFunction(*args, **kwargs)
14161416
elif len(args) == 1:
14171417
# Look for special cases defining differential/delay operator
14181418
if args[0] == 's':
@@ -1433,7 +1433,7 @@ def tf(*args):
14331433
raise ValueError("Needs 1 or 2 arguments; received %i." % len(args))
14341434

14351435

1436-
def ss2tf(*args):
1436+
def ss2tf(*args, **kwargs):
14371437
"""ss2tf(sys)
14381438
14391439
Transform a state space system to a transfer function.
@@ -1498,7 +1498,7 @@ def ss2tf(*args):
14981498
from .statesp import StateSpace
14991499
if len(args) == 4 or len(args) == 5:
15001500
# Assume we were given the A, B, C, D matrix and (optional) dt
1501-
return _convert_to_transfer_function(StateSpace(*args))
1501+
return _convert_to_transfer_function(StateSpace(*args, **kwargs))
15021502

15031503
elif len(args) == 1:
15041504
sys = args[0]

0 commit comments

Comments
 (0)
0