4444import matplotlib .pyplot as plt
4545import scipy as sp
4646import numpy as np
47+ import math
4748from .ctrlutil import unwrap
4849from .bdalg import feedback
4950
@@ -128,7 +129,7 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
128129 else :
129130 omega_limits = np .array (omega_limits )
130131 if Hz :
131- omega_limits *= 2. * np .pi
132+ omega_limits *= 2. * math .pi
132133 if omega_num :
133134 omega = sp .logspace (np .log10 (omega_limits [0 ]), np .log10 (omega_limits [1 ]), num = omega_num , endpoint = True )
134135 else :
@@ -142,7 +143,7 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
142143 else :
143144 omega_sys = np .array (omega )
144145 if sys .isdtime (True ):
145- nyquistfrq = 2. * np .pi * 1. / sys .dt / 2.
146+ nyquistfrq = 2. * math .pi * 1. / sys .dt / 2.
146147 omega_sys = omega_sys [omega_sys < nyquistfrq ]
147148 # TODO: What distance to the Nyquist frequency is appropriate?
148149 else :
@@ -154,9 +155,9 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
154155 phase = unwrap (phase )
155156 nyquistfrq_plot = None
156157 if Hz :
157- omega_plot = omega_sys / (2. * np .pi )
158+ omega_plot = omega_sys / (2. * math .pi )
158159 if nyquistfrq :
159- nyquistfrq_plot = nyquistfrq / (2. * np .pi )
160+ nyquistfrq_plot = nyquistfrq / (2. * math .pi )
160161 else :
161162 omega_plot = omega_sys
162163 if nyquistfrq :
@@ -187,7 +188,7 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
187188 # Phase plot
188189 ax_phase = plt .subplot (212 , sharex = ax_mag );
189190 if deg :
190- phase_plot = phase * 180. / np .pi
191+ phase_plot = phase * 180. / math .pi
191192 else :
192193 phase_plot = phase
193194 ax_phase .semilogx (omega_plot , phase_plot , * args , ** kwargs )
@@ -208,8 +209,8 @@ def genZeroCenteredSeries(val_min, val_max, period):
208209 ax_phase .set_yticks (genZeroCenteredSeries (ylim [0 ], ylim [1 ], 15. ), minor = True )
209210 else :
210211 ylim = ax_phase .get_ylim ()
211- ax_phase .set_yticks (genZeroCenteredSeries (ylim [0 ], ylim [1 ], np .pi / 4. ))
212- ax_phase .set_yticks (genZeroCenteredSeries (ylim [0 ], ylim [1 ], np .pi / 12. ), minor = True )
212+ ax_phase .set_yticks (genZeroCenteredSeries (ylim [0 ], ylim [1 ], math .pi / 4. ))
213+ ax_phase .set_yticks (genZeroCenteredSeries (ylim [0 ], ylim [1 ], math .pi / 12. ), minor = True )
213214 ax_phase .grid (True , which = 'both' )
214215 # ax_mag.grid(which='minor', alpha=0.3)
215216 # ax_mag.grid(which='major', alpha=0.9)
@@ -449,7 +450,7 @@ def default_frequency_range(syslist, Hz=None, number_of_samples=None, feature_pe
449450 features_ = features_ [features_ != 0.0 ];
450451 features = np .concatenate ((features , features_ ))
451452 elif sys .isdtime (strict = True ):
452- fn = np .pi * 1. / sys .dt
453+ fn = math .pi * 1. / sys .dt
453454 # TODO: What distance to the Nyquist frequency is appropriate?
454455 freq_interesting .append (fn * 0.9 )
455456
@@ -475,12 +476,12 @@ def default_frequency_range(syslist, Hz=None, number_of_samples=None, feature_pe
475476 features = np .array ([1. ]);
476477
477478 if Hz :
478- features /= 2. * np .pi
479+ features /= 2. * math .pi
479480 features = np .log10 (features )
480481 lsp_min = np .floor (np .min (features ) - feature_periphery_decade )
481482 lsp_max = np .ceil (np .max (features ) + feature_periphery_decade )
482- lsp_min += np .log10 (2. * np .pi )
483- lsp_max += np .log10 (2. * np .pi )
483+ lsp_min += np .log10 (2. * math .pi )
484+ lsp_max += np .log10 (2. * math .pi )
484485 else :
485486 features = np .log10 (features )
486487 lsp_min = np .floor (np .min (features ) - feature_periphery_decade )
0 commit comments