@@ -79,7 +79,7 @@ def hankel_singular_values(sys):
7979def model_reduction (
8080 sys , elim_states = None , method = 'matchdc' , elim_inputs = None ,
8181 elim_outputs = None , keep_states = None , keep_inputs = None ,
82- keep_outputs = None , remove_hidden_states = 'unobs' , warn_unstable = True ):
82+ keep_outputs = None , warn_unstable = True ):
8383 """Model reduction by input, output, or state elimination.
8484
8585 This function produces a reduced-order model of a system by eliminating
@@ -146,8 +146,9 @@ def model_reduction(
146146 other checking is done, so users to be careful not to render a system
147147 unobservable or unreachable.
148148
149- States, inputs, and outputs can be specified using integer offers.
150- Slices can also be specified, but must use the Python ``slice()`` function.
149+ States, inputs, and outputs can be specified using integer offers or
150+ using signal names. Slices can also be specified, but must use the
151+ Python ``slice()`` function.
151152
152153 """
153154 if not isinstance (sys , StateSpace ):
@@ -164,13 +165,17 @@ def _process_elim_or_keep(elim, keep, labels, allow_both=False):
164165 def _expand_key (key ):
165166 if key is None :
166167 return []
168+ elif isinstance (key , str ):
169+ return labels .index (key )
170+ elif isinstance (key , list ):
171+ return [_expand_key (k ) for k in key ]
167172 elif isinstance (key , slice ):
168173 return range (len (labels ))[key ]
169174 else :
170- return np . atleast_1d ( key )
175+ return key
171176
172- elim = _expand_key (elim )
173- keep = _expand_key (keep )
177+ elim = np . atleast_1d ( _expand_key (elim ) )
178+ keep = np . atleast_1d ( _expand_key (keep ) )
174179
175180 if len (elim ) > 0 and len (keep ) > 0 :
176181 if not allow_both :
0 commit comments