Skip to content

Commit 7668d2c

Browse files
committed
Fix ruff "unused value" warnings
1 parent 44db126 commit 7668d2c

6 files changed

Lines changed: 16 additions & 15 deletions

File tree

control/freqplot.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,11 @@ def _make_line_label(response, output_index, input_index):
759759
if plot_magnitude:
760760
ax_mag.axhline(y=0 if dB else 1, color='k', linestyle=':',
761761
zorder=-20)
762-
mag_ylim = ax_mag.get_ylim()
763762

764763
if plot_phase:
765764
ax_phase.axhline(y=phase_limit if deg else
766765
math.radians(phase_limit),
767766
color='k', linestyle=':', zorder=-20)
768-
phase_ylim = ax_phase.get_ylim()
769767

770768
# Annotate the phase margin (if it exists)
771769
if plot_phase and pm != float('inf') and Wcp != float('nan'):

control/modelsimp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def balanced_reduction(sys, orders, method='truncate', alpha=None):
340340

341341
# check if orders is a list or a scalar
342342
try:
343-
order = iter(orders)
343+
iter(orders)
344344
except TypeError: # if orders is a scalar
345345
orders = [orders]
346346

control/nlsys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __mul__(self, other):
210210
"can't multiply systems with incompatible inputs and outputs")
211211

212212
# Make sure timebase are compatible
213-
dt = common_timebase(other.dt, self.dt)
213+
common_timebase(other.dt, self.dt)
214214

215215
# Create a new system to handle the composition
216216
inplist = [(0, i) for i in range(other.ninputs)]
@@ -242,7 +242,7 @@ def __rmul__(self, other):
242242
"inputs and outputs")
243243

244244
# Make sure timebase are compatible
245-
dt = common_timebase(self.dt, other.dt)
245+
common_timebase(self.dt, other.dt)
246246

247247
# Create a new system to handle the composition
248248
inplist = [(0, i) for i in range(self.ninputs)]

control/phaseplot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def phase_plane_plot(
161161

162162
# Create copy of kwargs for later checking to find unused arguments
163163
initial_kwargs = dict(kwargs)
164-
passed_kwargs = False
165164

166165
# Utility function to create keyword arguments
167166
def _create_kwargs(global_kwargs, local_kwargs, **other_kwargs):
@@ -1143,10 +1142,11 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None,
11431142
if scale is None:
11441143
plt.quiver(x1, x2, dx[:,:,1], dx[:,:,2], angles='xy')
11451144
elif (scale != 0):
1145+
plt.quiver(x1, x2, dx[:,:,0]*np.abs(scale),
1146+
dx[:,:,1]*np.abs(scale), angles='xy')
11461147
#! TODO: optimize parameters for arrows
11471148
#! TODO: figure out arguments to make arrows show up correctly
1148-
xy = plt.quiver(x1, x2, dx[:,:,0]*np.abs(scale),
1149-
dx[:,:,1]*np.abs(scale), angles='xy')
1149+
# xy = plt.quiver(...)
11501150
# set(xy, 'LineWidth', PP_arrow_linewidth, 'Color', 'b')
11511151

11521152
#! TODO: Tweak the shape of the plot
@@ -1256,15 +1256,17 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None,
12561256
#! TODO: figure out arguments to make arrows show up correctly
12571257
plt.quiver(x1, x2, dx[:,:,0], dx[:,:,1], angles='xy')
12581258
elif scale != 0 and Narrows > 0:
1259+
plt.quiver(x1, x2, dx[:,:,0]*abs(scale), dx[:,:,1]*abs(scale),
1260+
angles='xy')
12591261
#! TODO: figure out arguments to make arrows show up correctly
1260-
xy = plt.quiver(x1, x2, dx[:,:,0]*abs(scale), dx[:,:,1]*abs(scale),
1261-
angles='xy')
1262+
# xy = plt.quiver(...)
12621263
# set(xy, 'LineWidth', PP_arrow_linewidth)
12631264
# set(xy, 'AutoScale', 'off')
12641265
# set(xy, 'AutoScaleFactor', 0)
12651266

12661267
if scale < 0:
1267-
bp = plt.plot(x1, x2, 'b.'); # add dots at base
1268+
plt.plot(x1, x2, 'b.'); # add dots at base
1269+
# bp = plt.plot(...)
12681270
# set(bp, 'MarkerSize', PP_arrow_markersize)
12691271

12701272

control/stochsys.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ def lqe(*args, **kwargs):
166166

167167
# Get the cross-covariance matrix, if given
168168
if (len(args) > index + 2):
169-
NN = np.array(args[index+2], ndmin=2, dtype=float)
169+
# NN = np.array(args[index+2], ndmin=2, dtype=float)
170170
raise ControlNotImplemented("cross-covariance not implemented")
171171

172172
else:
173+
pass
173174
# For future use (not currently used below)
174-
NN = np.zeros((QN.shape[0], RN.shape[1]))
175+
# NN = np.zeros((QN.shape[0], RN.shape[1]))
176+
175177

176178
# Check dimensions of G (needed before calling care())
177179
_check_shape("QN", QN, G.shape[1], G.shape[1])
@@ -290,7 +292,7 @@ def dlqe(*args, **kwargs):
290292
# NN = np.zeros(QN.size(0),RN.size(1))
291293
# NG = G @ NN
292294
if len(args) > index + 2:
293-
NN = np.array(args[index+2], ndmin=2, dtype=float)
295+
# NN = np.array(args[index+2], ndmin=2, dtype=float)
294296
raise ControlNotImplemented("cross-covariance not yet implememented")
295297

296298
# Check dimensions of G (needed before calling care())

control/xferfcn.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,6 @@ def _convert_to_transfer_function(
15031503
15041504
"""
15051505
from .statesp import StateSpace
1506-
kwargs = {}
15071506

15081507
if isinstance(sys, TransferFunction):
15091508
return sys

0 commit comments

Comments
 (0)