Skip to content

Commit dcf12fd

Browse files
committed
PEP8 cleanup
1 parent 4450cf8 commit dcf12fd

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

control/nichols.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
# Default parameters values for the nichols module
6262
_nichols_defaults = {
63-
'nichols.grid':True,
63+
'nichols.grid': True,
6464
}
6565

6666

@@ -156,12 +156,13 @@ def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted'):
156156
# Default chart magnitudes
157157
# The key set of magnitudes are always generated, since this
158158
# guarantees a recognizable Nichols chart grid.
159-
key_cl_mags = np.array([-40.0, -20.0, -12.0, -6.0, -3.0, -1.0, -0.5, 0.0,
160-
0.25, 0.5, 1.0, 3.0, 6.0, 12.0])
159+
key_cl_mags = np.array([-40.0, -20.0, -12.0, -6.0, -3.0, -1.0, -0.5,
160+
0.0, 0.25, 0.5, 1.0, 3.0, 6.0, 12.0])
161+
161162
# Extend the range of magnitudes if necessary. The extended arange
162-
# will end up empty if no extension is required. Assumes that closed-loop
163-
# magnitudes are approximately aligned with open-loop magnitudes beyond
164-
# the value of np.min(key_cl_mags)
163+
# will end up empty if no extension is required. Assumes that
164+
# closed-loop magnitudes are approximately aligned with open-loop
165+
# magnitudes beyond the value of np.min(key_cl_mags)
165166
cl_mag_step = -20.0 # dB
166167
extended_cl_mags = np.arange(np.min(key_cl_mags),
167168
ol_mag_min + cl_mag_step, cl_mag_step)
@@ -171,7 +172,8 @@ def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted'):
171172
if cl_phases is None:
172173
# Choose a reasonable set of default phases (denser if the open-loop
173174
# data is restricted to a relatively small range of phases).
174-
key_cl_phases = np.array([-0.25, -45.0, -90.0, -180.0, -270.0, -325.0, -359.75])
175+
key_cl_phases = np.array([-0.25, -45.0, -90.0, -180.0, -270.0,
176+
-325.0, -359.75])
175177
if np.abs(ol_phase_max - ol_phase_min) < 90.0:
176178
other_cl_phases = np.arange(-10.0, -360.0, -10.0)
177179
else:
@@ -181,7 +183,8 @@ def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted'):
181183
assert ((-360.0 < np.min(cl_phases)) and (np.max(cl_phases) < 0.0))
182184

183185
# Find the M-contours
184-
m = m_circles(cl_mags, phase_min=np.min(cl_phases), phase_max=np.max(cl_phases))
186+
m = m_circles(cl_mags, phase_min=np.min(cl_phases),
187+
phase_max=np.max(cl_phases))
185188
m_mag = 20*sp.log10(np.abs(m))
186189
m_phase = sp.mod(sp.degrees(sp.angle(m)), -360.0) # Unwrap
187190

@@ -208,9 +211,11 @@ def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted'):
208211
linestyle=line_style, zorder=0)
209212

210213
# Add magnitude labels
211-
for x, y, m in zip(m_phase[:][-1] + phase_offset, m_mag[:][-1], cl_mags):
214+
for x, y, m in zip(m_phase[:][-1] + phase_offset, m_mag[:][-1],
215+
cl_mags):
212216
align = 'right' if m < 0.0 else 'left'
213-
plt.text(x, y, str(m) + ' dB', size='small', ha=align, color='gray')
217+
plt.text(x, y, str(m) + ' dB', size='small', ha=align,
218+
color='gray')
214219

215220
# Fit axes to generated chart
216221
plt.axis([phase_offset_min - 360.0, phase_offset_max - 360.0,

control/pzmap.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050

5151
# Define default parameter values for this module
5252
_pzmap_defaults = {
53-
'pzmap.grid':False, # Plot omega-damping grid
54-
'pzmap.plot':True, # Generate plot using Matplotlib
53+
'pzmap.grid': False, # Plot omega-damping grid
54+
'pzmap.plot': True, # Generate plot using Matplotlib
5555
}
5656

5757

@@ -89,7 +89,7 @@ def pzmap(sys, plot=True, grid=False, title='Pole Zero Map', **kwargs):
8989
# Get parameter values
9090
plot = config._get_param('rlocus', 'plot', plot, True)
9191
grid = config._get_param('rlocus', 'grid', grid, False)
92-
92+
9393
if not isinstance(sys, LTI):
9494
raise TypeError('Argument ``sys``: must be a linear system.')
9595

@@ -115,7 +115,6 @@ def pzmap(sys, plot=True, grid=False, title='Pole Zero Map', **kwargs):
115115
ax.scatter(real(zeros), imag(zeros), s=50, marker='o',
116116
facecolors='none', edgecolors='k')
117117

118-
119118
plt.title(title)
120119

121120
# Return locations of poles and zeros as a tuple

control/rlocus.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262

6363
# Default values for module parameters
6464
_rlocus_defaults = {
65-
'rlocus.grid':True,
66-
'rlocus.plotstr':'b' if int(matplotlib.__version__[0]) == 1 else 'C0',
67-
'rlocus.print_gain':True,
68-
'rlocus.plot':True
65+
'rlocus.grid': True,
66+
'rlocus.plotstr': 'b' if int(matplotlib.__version__[0]) == 1 else 'C0',
67+
'rlocus.print_gain': True,
68+
'rlocus.plot': True
6969
}
7070

7171

@@ -110,7 +110,7 @@ def root_locus(sys, kvect=None, xlim=None, ylim=None,
110110
warnings.warn("'Plot' keyword is deprecated in root_locus; "
111111
"use 'plot'", FutureWarning)
112112
# Map 'Plot' keyword to 'plot' keyword
113-
plot= kwargs.pop('Plot')
113+
plot = kwargs.pop('Plot')
114114

115115
# Check to see if legacy 'PrintGain' keyword was used
116116
if 'PrintGain' in kwargs:

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
# Define module default parameter values
7272
_statesp_defaults = {
73-
'statesp.use_numpy_matrix':True,
73+
'statesp.use_numpy_matrix': True,
7474
}
7575

7676

0 commit comments

Comments
 (0)