5757 polyadd , polymul , polyval , roots , sqrt , zeros , squeeze , exp , pi , \
5858 where , delete , real , poly , nonzero
5959import scipy as sp
60- from scipy .signal import lti , tf2zpk , zpk2tf , cont2discrete
60+ from scipy .signal import tf2zpk , zpk2tf , cont2discrete
61+ from scipy .signal import TransferFunction as signalTransferFunction
6162from copy import deepcopy
6263from warnings import warn
6364from itertools import chain
@@ -788,7 +789,7 @@ def minreal(self, tol=None):
788789 # end result
789790 return TransferFunction (num , den , self .dt )
790791
791- def returnScipySignalLTI (self ):
792+ def returnScipySignalLTI (self , strict = True ):
792793 """Return a list of a list of scipy.signal.lti objects.
793794
794795 For instance,
@@ -799,19 +800,38 @@ def returnScipySignalLTI(self):
799800 is a signal.scipy.lti object corresponding to the
800801 transfer function from the 6th input to the 4th output.
801802
803+ Parameters
804+ ----------
805+ strict : bool, optional
806+ True (default):
807+ `tfobject` must be continuous or discrete.
808+ `tfobject.dt`cannot be None.
809+ False:
810+ if `tfobject.dt` is None, continuous time signal.TransferFunction
811+ objects are is returned
812+
813+ Returns
814+ -------
815+ out : list of list of scipy.signal.TransferFunction
802816 """
817+ if strict and self .dt is None :
818+ raise ValueError ("with strict=True, dt cannot be None" )
803819
804- # TODO: implement for discrete time systems
805- if self .dt != 0 and self .dt is not None :
806- raise NotImplementedError ("Function not \
807- implemented in discrete time" )
820+ if self .dt :
821+ kwdt = {'dt' : self .dt }
822+ else :
823+ # scipy convention for continuous time lti systems: call without
824+ # dt keyword argument
825+ kwdt = {}
808826
809827 # Preallocate the output.
810828 out = [[[] for j in range (self .inputs )] for i in range (self .outputs )]
811829
812830 for i in range (self .outputs ):
813831 for j in range (self .inputs ):
814- out [i ][j ] = lti (self .num [i ][j ], self .den [i ][j ])
832+ out [i ][j ] = signalTransferFunction (self .num [i ][j ],
833+ self .den [i ][j ],
834+ ** kwdt )
815835
816836 return out
817837
0 commit comments