Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dfc0ead
Handle non-* unused import-related messages
roryyorke Jan 25, 2025
eb70132
Silence ruff warnings in __init__.py
roryyorke Feb 1, 2025
c135d2f
Make flatsys/__init__.py ruff-clean
roryyorke Feb 1, 2025
c6dbe07
Silence ruff warnings in matlab/__init__.py
roryyorke Feb 1, 2025
9427eec
Turn f-strings without format-parameters into normal strings (ruff)
roryyorke Feb 1, 2025
5ba2ad5
Fix ruff warnings in robust.py
roryyorke Feb 1, 2025
67fa35d
Apply ruff pyflakes rules to control library only
roryyorke Feb 1, 2025
44db126
Import `ControlArgument` in flatsys.py, with test
roryyorke Feb 1, 2025
7668d2c
Fix ruff "unused value" warnings
roryyorke Feb 1, 2025
ae5a702
Fixed ruff unused argument warning in acker
roryyorke Feb 1, 2025
f9c5b3b
Fix ruff shadowed symbol warning in xferfcn.py
roryyorke Feb 1, 2025
71ea2d7
Fix various ruff unknown symbol warnings
roryyorke Feb 1, 2025
d1ac450
Change _RLSortRoots in rlocus.py to placate ruff
roryyorke Feb 1, 2025
d8b8b2d
Remove unused import
roryyorke Feb 1, 2025
a032506
Silence ruff warning in phaseplot.py
roryyorke Feb 1, 2025
5421a63
Add ruff check Github Action workflow
roryyorke Feb 1, 2025
32ba227
Update docstring_test hashes
roryyorke Feb 2, 2025
b4776c4
Fix comment wording
roryyorke Feb 2, 2025
bd705f2
Remove pyflakes weirdness, use noqa instead
roryyorke Feb 2, 2025
76b2a34
Merge main into lint-lib-only
roryyorke Feb 2, 2025
ce13465
Update dlqe, lqe hashes in docstrings_test.py
roryyorke Feb 2, 2025
b333298
Remove import of unused ControlDimension
roryyorke Feb 2, 2025
18d3d59
Import missing StateSpace
roryyorke Feb 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ruff "unused value" warnings
  • Loading branch information
roryyorke committed Feb 2, 2025
commit 7668d2c70db297f93f7e9a3829d339c4e2b728e7
2 changes: 0 additions & 2 deletions control/freqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,11 @@ def _make_line_label(response, output_index, input_index):
if plot_magnitude:
ax_mag.axhline(y=0 if dB else 1, color='k', linestyle=':',
zorder=-20)
mag_ylim = ax_mag.get_ylim()

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

# Annotate the phase margin (if it exists)
if plot_phase and pm != float('inf') and Wcp != float('nan'):
Expand Down
2 changes: 1 addition & 1 deletion control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def balanced_reduction(sys, orders, method='truncate', alpha=None):

# check if orders is a list or a scalar
try:
order = iter(orders)
iter(orders)
except TypeError: # if orders is a scalar
orders = [orders]

Expand Down
4 changes: 2 additions & 2 deletions control/nlsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def __mul__(self, other):
"can't multiply systems with incompatible inputs and outputs")

# Make sure timebase are compatible
dt = common_timebase(other.dt, self.dt)
common_timebase(other.dt, self.dt)

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

# Make sure timebase are compatible
dt = common_timebase(self.dt, other.dt)
common_timebase(self.dt, other.dt)

# Create a new system to handle the composition
inplist = [(0, i) for i in range(self.ninputs)]
Expand Down
14 changes: 8 additions & 6 deletions control/phaseplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def phase_plane_plot(

# Create copy of kwargs for later checking to find unused arguments
initial_kwargs = dict(kwargs)
passed_kwargs = False

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

#! TODO: Tweak the shape of the plot
Expand Down Expand Up @@ -1256,15 +1256,17 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None,
#! TODO: figure out arguments to make arrows show up correctly
plt.quiver(x1, x2, dx[:,:,0], dx[:,:,1], angles='xy')
elif scale != 0 and Narrows > 0:
plt.quiver(x1, x2, dx[:,:,0]*abs(scale), dx[:,:,1]*abs(scale),
angles='xy')
#! TODO: figure out arguments to make arrows show up correctly
xy = plt.quiver(x1, x2, dx[:,:,0]*abs(scale), dx[:,:,1]*abs(scale),
angles='xy')
# xy = plt.quiver(...)
# set(xy, 'LineWidth', PP_arrow_linewidth)
# set(xy, 'AutoScale', 'off')
# set(xy, 'AutoScaleFactor', 0)

if scale < 0:
bp = plt.plot(x1, x2, 'b.'); # add dots at base
plt.plot(x1, x2, 'b.'); # add dots at base
# bp = plt.plot(...)
# set(bp, 'MarkerSize', PP_arrow_markersize)


Expand Down
8 changes: 5 additions & 3 deletions control/stochsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ def lqe(*args, **kwargs):

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

else:
pass
# For future use (not currently used below)
NN = np.zeros((QN.shape[0], RN.shape[1]))
# NN = np.zeros((QN.shape[0], RN.shape[1]))


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

# Check dimensions of G (needed before calling care())
Expand Down
1 change: 0 additions & 1 deletion control/xferfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,6 @@ def _convert_to_transfer_function(

"""
from .statesp import StateSpace
kwargs = {}

if isinstance(sys, TransferFunction):
return sys
Expand Down