@@ -89,9 +89,9 @@ def model_reduction(
89
89
eliminated or those to be kept.
90
90
91
91
Two methods of state reduction are possible: 'truncate' removes the
92
- states marked for elimination, while 'matchdc' replaces the the
93
- eliminated states with their equilibrium values (thereby keeping the
94
- input/output gain unchanged at zero frequency ["DC"]).
92
+ states marked for elimination, while 'matchdc' replaces the eliminated
93
+ states with their equilibrium values (thereby keeping the input/output
94
+ gain unchanged at zero frequency ["DC"]).
95
95
96
96
Parameters
97
97
----------
@@ -104,9 +104,8 @@ def model_reduction(
104
104
Vector of inputs, outputs, or states to keep. Can be specified
105
105
either as an offset into the appropriate vector or as a signal name.
106
106
method : string
107
- Method of removing states in `elim`: either 'truncate' or
108
- 'matchdc' (default).
109
- warn_unstable: bool, option
107
+ Method of removing states: either 'truncate' or 'matchdc' (default).
108
+ warn_unstable : bool, option
110
109
If `False`, don't warn if system is unstable.
111
110
112
111
Returns
@@ -136,23 +135,23 @@ def model_reduction(
136
135
See Also
137
136
--------
138
137
balanced_reduction : Eliminate states using Hankel singular values.
139
- minimal_realization : Eliminate unreachable or unobseravble states.
138
+ minimal_realization : Eliminate unreachable or unobservable states.
140
139
141
140
Notes
142
141
-----
143
142
The model_reduction function issues a warning if the system has
144
- unstable eigenvalues, since in those situations the stability reduced
145
- order model may be different that the stability of the full model. No
146
- other checking is done, so users to be careful not to render a system
147
- unobservable or unreachable.
143
+ unstable eigenvalues, since in those situations the stability of the
144
+ reduced order model may be different than the stability of the full
145
+ model. No other checking is done, so users must to be careful not to
146
+ render a system unobservable or unreachable.
148
147
149
- States, inputs, and outputs can be specified using integer offers or
148
+ States, inputs, and outputs can be specified using integer offsets or
150
149
using signal names. Slices can also be specified, but must use the
151
150
Python ``slice()`` function.
152
151
153
152
"""
154
153
if not isinstance (sys , StateSpace ):
155
- raise TypeError ("system must be a a StateSpace system" )
154
+ raise TypeError ("system must be a StateSpace system" )
156
155
157
156
# Check system is stable
158
157
if warn_unstable :
@@ -161,7 +160,7 @@ def model_reduction(
161
160
warnings .warn ("System is unstable; reduction may be meaningless" )
162
161
163
162
# Utility function to process keep/elim keywords
164
- def _process_elim_or_keep (elim , keep , labels , allow_both = False ):
163
+ def _process_elim_or_keep (elim , keep , labels ):
165
164
def _expand_key (key ):
166
165
if key is None :
167
166
return []
@@ -178,9 +177,8 @@ def _expand_key(key):
178
177
keep = np .atleast_1d (_expand_key (keep ))
179
178
180
179
if len (elim ) > 0 and len (keep ) > 0 :
181
- if not allow_both :
182
- raise ValueError (
183
- "can't provide both 'keep' and 'elim' for same variables" )
180
+ raise ValueError (
181
+ "can't provide both 'keep' and 'elim' for same variables" )
184
182
elif len (keep ) > 0 :
185
183
keep = np .sort (keep ).tolist ()
186
184
elim = [i for i in range (len (labels )) if i not in keep ]
0 commit comments