Skip to content

Commit 31e6944

Browse files
authored
Merge pull request #265 from don4get/refactor/xferfcn.py
Clean up of xferfcn.py (PEP8, etc)
2 parents be59f62 + 5731918 commit 31e6944

File tree

8 files changed

+351
-365
lines changed

8 files changed

+351
-365
lines changed

control/bdalg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,14 @@ def feedback(sys1, sys2=1, sign=-1):
239239
# its feedback member function.
240240
if isinstance(sys1, (int, float, complex, np.number)):
241241
if isinstance(sys2, tf.TransferFunction):
242-
sys1 = tf._convertToTransferFunction(sys1)
242+
sys1 = tf._convert_to_transfer_function(sys1)
243243
elif isinstance(sys2, ss.StateSpace):
244244
sys1 = ss._convertToStateSpace(sys1)
245245
elif isinstance(sys2, frd.FRD):
246246
sys1 = ss._convertToFRD(sys1)
247247
else: # sys2 is a scalar.
248-
sys1 = tf._convertToTransferFunction(sys1)
249-
sys2 = tf._convertToTransferFunction(sys2)
248+
sys1 = tf._convert_to_transfer_function(sys1)
249+
sys2 = tf._convert_to_transfer_function(sys2)
250250

251251
return sys1.feedback(sys2, sign)
252252

control/margins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def stability_margins(sysdata, returnall=False, epsw=0.0):
144144
sys = frdata.FRD(mag * np.exp(1j * phase * math.pi/180),
145145
omega, smooth=True)
146146
else:
147-
sys = xferfcn._convertToTransferFunction(sysdata)
147+
sys = xferfcn._convert_to_transfer_function(sysdata)
148148
except Exception as e:
149149
print (e)
150150
raise ValueError("Margin sysdata must be either a linear system or "
@@ -299,7 +299,7 @@ def phase_crossover_frequencies(sys):
299299
"""
300300

301301
# Convert to a transfer function
302-
tf = xferfcn._convertToTransferFunction(sys)
302+
tf = xferfcn._convert_to_transfer_function(sys)
303303

304304
# if not siso, fall back to (0,0) element
305305
#! TODO: should add a check and warning here

control/rlocus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
from math import pi
5252
import scipy.signal # signal processing toolbox
5353
import pylab # plotting routines
54-
from .xferfcn import _convertToTransferFunction
54+
from .xferfcn import _convert_to_transfer_function
5555
from .exception import ControlMIMONotImplemented
5656
from functools import partial
5757
from .lti import isdtime
@@ -288,7 +288,7 @@ def _systopoly1d(sys):
288288

289289
else:
290290
# Convert to a transfer function, if needed
291-
sys = _convertToTransferFunction(sys)
291+
sys = _convert_to_transfer_function(sys)
292292

293293
# Make sure we have a SISO system
294294
if (sys.inputs > 1 or sys.outputs > 1):

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
from scipy.signal import lti, cont2discrete
6363
from warnings import warn
6464
from .lti import LTI, timebase, timebaseEqual, isdtime
65-
from .xferfcn import _convertToTransferFunction
65+
from .xferfcn import _convert_to_transfer_function
6666
from copy import deepcopy
6767

6868
__all__ = ['StateSpace', 'ss', 'rss', 'drss', 'tf2ss', 'ssdata']

control/tests/timeresp_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# import scipy as sp
1414
from control.timeresp import *
1515
from control.statesp import *
16-
from control.xferfcn import TransferFunction, _convertToTransferFunction
16+
from control.xferfcn import TransferFunction, _convert_to_transfer_function
1717
from control.dtime import c2d
1818
from control.exception import slycot_check
1919

@@ -28,7 +28,7 @@ def setUp(self):
2828

2929
# Create some transfer functions
3030
self.siso_tf1 = TransferFunction([1], [1, 2, 1])
31-
self.siso_tf2 = _convertToTransferFunction(self.siso_ss1)
31+
self.siso_tf2 = _convert_to_transfer_function(self.siso_ss1)
3232

3333
# Create MIMO system, contains ``siso_ss1`` twice
3434
A = np.matrix("1. -2. 0. 0.;"

0 commit comments

Comments
 (0)