2121
2222from . import config
2323from .exception import pandas_check
24- from .iosys import InputOutputSystem , NamedSignal , _process_iosys_keywords , \
25- _process_subsys_index , common_timebase
24+ from .iosys import InputOutputSystem , NamedSignal , _extended_system_name , \
25+ _process_iosys_keywords , _process_subsys_index , common_timebase
2626from .lti import LTI , _process_frequency_response
2727
2828__all__ = ['FrequencyResponseData' , 'FRD' , 'frd' ]
@@ -195,6 +195,14 @@ def __init__(self, *args, **kwargs):
195195 self .fresp = otherlti (z , squeeze = False )
196196 arg_dt = otherlti .dt
197197
198+ # Copy over signal and system names, if not specified
199+ kwargs ['inputs' ] = kwargs .get ('inputs' , otherlti .input_labels )
200+ kwargs ['outputs' ] = kwargs .get (
201+ 'outputs' , otherlti .output_labels )
202+ if not otherlti ._generic_name_check ():
203+ kwargs ['name' ] = kwargs .get ('name' , _extended_system_name (
204+ otherlti .name , prefix_suffix_name = 'sampled' ))
205+
198206 else :
199207 # The user provided a response and a freq vector
200208 self .fresp = array (args [0 ], dtype = complex , ndmin = 1 )
@@ -219,6 +227,10 @@ def __init__(self, *args, **kwargs):
219227 self .fresp = args [0 ].fresp
220228 arg_dt = args [0 ].dt
221229
230+ # Copy over signal and system names, if not specified
231+ kwargs ['inputs' ] = kwargs .get ('inputs' , args [0 ].input_labels )
232+ kwargs ['outputs' ] = kwargs .get ('outputs' , args [0 ].output_labels )
233+
222234 else :
223235 raise ValueError (
224236 "Needs 1 or 2 arguments; received %i." % len (args ))
@@ -249,7 +261,11 @@ def __init__(self, *args, **kwargs):
249261
250262 # Process iosys keywords
251263 defaults = {
252- 'inputs' : self .fresp .shape [1 ], 'outputs' : self .fresp .shape [0 ]}
264+ 'inputs' : self .fresp .shape [1 ] if not getattr (
265+ self , 'input_index' , None ) else self .input_labels ,
266+ 'outputs' : self .fresp .shape [0 ] if not getattr (
267+ self , 'output_index' , None ) else self .output_labels ,
268+ 'name' : getattr (self , 'name' , None )}
253269 if arg_dt is not None :
254270 defaults ['dt' ] = arg_dt # choose compatible timebase
255271 name , inputs , outputs , states , dt = _process_iosys_keywords (
0 commit comments