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 ,
0 commit comments