8000 deprecate ctrlutil.issys() · ControlCorp/python-control@1d670a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d670a7

Browse files
committed
deprecate ctrlutil.issys()
1 parent 6a18702 commit 1d670a7

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

control/ctrlutil.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from . import lti
4545
import numpy as np
4646
import math
47+
import warnings
4748

4849
__all__ = ['unwrap', 'issys', 'db2mag', 'mag2db']
4950

@@ -99,6 +100,8 @@ def issys(obj):
99100
False
100101
101102
"""
103+
warnings.warn("issys() is deprecated; use isinstance(obj, ct.LTI)",
104+
FutureWarning, stacklevel=2)
102105
return isinstance(obj, lti.LTI)
103106

104107
def db2mag(db):

control/matlab/wrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
from ..iosys import ss
77
from ..xferfcn import tf
8-
from ..ctrlutil import issys
8+
from ..lti import LTI
99
from ..exception import ControlArgument
1010
from scipy.signal import zpk2tf
1111
from warnings import warn
@@ -124,7 +124,7 @@ def _parse_freqplot_args(*args):
124124
i = 0
125125
while i < len(args):
126126
# Check to see if this is a system of some sort
127-
if issys(args[i]):
127+
if isinstance(args[i], LTI):
128128
# Append the system to our list of systems
129129
syslist.append(args[i])
130130
i += 1

control/tests/ctrlutil_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""ctrlutil_test.py"""
22

33
import numpy as np
4-
4+
import pytest
5+
import control as ct
56
from control.ctrlutil import db2mag, mag2db, unwrap
67

78
class TestUtils:
@@ -58,3 +59,8 @@ def test_mag2db(self):
5859
def test_mag2db_array(self):
5960
db_array = mag2db(self.mag)
6061
np.testing.assert_array_almost_equal(db_array, self.db)
62+
63+
def test_issys(self):
64+
sys = ct.rss(2, 1, 1)
65+
with pytest.warns(FutureWarning, match="deprecated; use isinstance"):
66+
ct.issys(sys)

0 commit comments

Comments
 (0)
0