4949"""
5050
5151# External function declarations
52+ import numpy as np
5253from numpy import angle , array , empty , ones , \
5354 real , imag , matrix , absolute , eye , linalg , where , dot
5455from scipy .interpolate import splprep , splev
@@ -223,7 +224,7 @@ def __mul__(self, other):
223224 """Multiply two LTI objects (serial connection)."""
224225
225226 # Convert the second argument to a transfer function.
226- if isinstance (other , (int , float , complex )):
227+ if isinstance (other , (int , float , complex , np . number )):
227228 return FRD (self .fresp * other , self .omega ,
228229 smooth = (self .ifunc is not None ))
229230 else :
@@ -249,7 +250,7 @@ def __rmul__(self, other):
249250 """Right Multiply two LTI objects (serial connection)."""
250251
251252 # Convert the second argument to an frd function.
252- if isinstance (other , (int , float , complex )):
253+ if isinstance (other , (int , float , complex , np . number )):
253254 return FRD (self .fresp * other , self .omega ,
254255 smooth = (self .ifunc is not None ))
255256 else :
@@ -276,7 +277,7 @@ def __rmul__(self, other):
276277 def __truediv__ (self , other ):
277278 """Divide two LTI objects."""
278279
279- if isinstance (other , (int , float , complex )):
280+ if isinstance (other , (int , float , complex , np . number )):
280281 return FRD (self .fresp * (1 / other ), self .omega ,
281282 smooth = (self .ifunc is not None ))
282283 else :
@@ -299,7 +300,7 @@ def __div__(self, other):
299300 # TODO: Division of MIMO transfer function objects is not written yet.
300301 def __rtruediv__ (self , other ):
301302 """Right divide two LTI objects."""
302- if isinstance (other , (int , float , complex )):
303+ if isinstance (other , (int , float , complex , np . number )):
303304 return FRD (other / self .fresp , self .omega ,
304305 smooth = (self .ifunc is not None ))
305306 else :
@@ -453,7 +454,7 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1):
453454
454455 return FRD (fresp , omega , smooth = True )
455456
456- elif isinstance (sys , (int , float , complex )):
457+ elif isinstance (sys , (int , float , complex , np . number )):
457458 fresp = ones ((outputs , inputs , len (omega )), dtype = float )* sys
458459 return FRD (fresp , omega , smooth = True )
459460
0 commit comments