5454
5555from .lti import LTI , _process_frequency_response
5656from .exception import pandas_check
57- from .namedio import _NamedIOSystem
57+ from .namedio import NamedIOSystem , _process_namedio_keywords
5858from . import config
5959
6060__all__ = ['FrequencyResponseData' , 'FRD' , 'frd' ]
6161
6262
63- class FrequencyResponseData (LTI , _NamedIOSystem ):
63+ class FrequencyResponseData (LTI ):
6464 """FrequencyResponseData(d, w[, smooth])
6565
6666 A class for models defined by frequency response data (FRD).
@@ -117,7 +117,7 @@ class FrequencyResponseData(LTI, _NamedIOSystem):
117117
118118 # Allow NDarray * StateSpace to give StateSpace._rmul_() priority
119119 # https://docs.scipy.org/doc/numpy/reference/arrays.classes.html
120- __array_priority__ = 11 # override ndarray and matrix types
120+ __array_priority__ = 13 # override ndarray, StateSpace, I/O sys
121121
122122 #
123123 # Class attributes
@@ -157,6 +157,9 @@ def __init__(self, *args, **kwargs):
157157 # TODO: discrete-time FRD systems?
158158 smooth = kwargs .pop ('smooth' , False )
159159
160+ #
161+ # Process positional arguments
162+ #
160163 if len (args ) == 2 :
161164 if not isinstance (args [0 ], FRD ) and isinstance (args [0 ], LTI ):
162165 # not an FRD, but still a system, second argument should be
@@ -196,28 +199,28 @@ def __init__(self, *args, **kwargs):
196199 raise ValueError (
197200 "Needs 1 or 2 arguments; received %i." % len (args ))
198201
199- # Set the size of the system
200- self .noutputs = self .fresp .shape [0 ]
201- self .ninputs = self .fresp .shape [1 ]
202-
203- # Process signal names
204- _NamedIOSystem .__init__ (
205- self , name = kwargs .pop ('name' , None ),
206- inputs = kwargs .pop ('inputs' , self .ninputs ),
207- outputs = kwargs .pop ('outputs' , self .noutputs ))
208-
202+ #
203+ # Process key word arguments
204+ #
209205 # Keep track of return type
210206 self .return_magphase = kwargs .pop ('return_magphase' , False )
211207 if self .return_magphase not in (True , False ):
212208 raise ValueError ("unknown return_magphase value" )
213209
210+ # Determine whether to squeeze the output
214211 self .squeeze = kwargs .pop ('squeeze' , None )
215212 if self .squeeze not in (None , True , False ):
216213 raise ValueError ("unknown squeeze value" )
217214
218- # Make sure there were no extraneous keywords
219- if kwargs :
220- raise TypeError ("unrecognized keywords: " , str (kwargs ))
215+ # Process namedio keywords
216+ defaults = {
217+ 'inputs' : self .fresp .shape [1 ], 'outputs' : self .fresp .shape [0 ]}
218+ name , inputs , outputs , states , dt = _process_namedio_keywords (
219+ kwargs , defaults , end = True )
220+
221+ # Process signal names
222+ NamedIOSystem .__init__ (
223+ self , name = name , inputs = inputs , outputs = outputs , dt = dt )
221224
222225 # create interpolation functions
223226 if smooth :
@@ -231,7 +234,6 @@ def __init__(self, *args, **kwargs):
231234 w = 1.0 / (absolute (self .fresp [i , j , :]) + 0.001 ), s = 0.0 )
232235 else :
233236 self .ifunc = None
234- super ().__init__ (self .fresp .shape [1 ], self .fresp .shape [0 ])
235237
236238 #
237239 # Frequency response properties
@@ -666,8 +668,6 @@ def to_pandas(self):
666668# FrequenceResponseData and then assigning FRD to point to the same object
667669# fixes this problem.
668670#
669-
670-
671671FRD = FrequencyResponseData
672672
673673
0 commit comments