6363_freqplot_defaults = {
6464 'freqplot.feature_periphery_decades' : 1 ,
6565 'freqplot.number_of_samples' : 1000 ,
66+ 'freqplot.dB' : False , # Plot gain in dB
67+ 'freqplot.deg' : True , # Plot phase in degrees
68+ 'freqplot.Hz' : False , # Plot frequency in Hertz
69+ 'freqplot.grid' : True , # Turn on grid for gain and phase
70+ 'freqplot.wrap_phase' : False , # Wrap the phase plot at a given value
6671}
6772
6873#
7681# Bode plot
7782#
7883
79- # Default values for Bode plot configuration variables
80- _bode_defaults = {
81- 'bode.dB' : False , # Plot gain in dB
82- 'bode.deg' : True , # Plot phase in degrees
83- 'bode.Hz' : False , # Plot frequency in Hertz
84- 'bode.grid' : True , # Turn on grid for gain and phase
85- 'bode.wrap_phase' : False , # Wrap the phase plot at a given value
86- }
87-
8884
8985def bode_plot (syslist , omega = None ,
9086 plot = True , omega_limits = None , omega_num = None ,
@@ -103,10 +99,10 @@ def bode_plot(syslist, omega=None,
10399 If True, plot result in dB. Default is false.
104100 Hz : bool
105101 If True, plot frequency in Hz (omega must be provided in rad/sec).
106- Default value (False) set by config.defaults['bode .Hz']
102+ Default value (False) set by config.defaults['freqplot .Hz']
107103 deg : bool
108104 If True, plot phase in degrees (else radians). Default value (True)
109- config.defaults['bode .deg']
105+ config.defaults['freqplot .deg']
110106 plot : bool
111107 If True (default), plot magnitude and phase
112108 omega_limits : array_like of two values
@@ -184,16 +180,21 @@ def bode_plot(syslist, omega=None,
184180 plot = kwargs .pop ('Plot' )
185181
186182 # Get values for params (and pop from list to allow keyword use in plot)
187- dB = config ._get_param ('bode' , 'dB' , kwargs , _bode_defaults , pop = True )
188- deg = config ._get_param ('bode' , 'deg' , kwargs , _bode_defaults , pop = True )
189- Hz = config ._get_param ('bode' , 'Hz' , kwargs , _bode_defaults , pop = True )
190- grid = config ._get_param ('bode' , 'grid' , kwargs , _bode_defaults , pop = True )
191- plot = config ._get_param ('bode' , 'plot' , plot , True )
192- margins = config ._get_param ('bode' , 'margins' , margins , False )
183+ dB = config ._get_param (
184+ 'freqplot' , 'dB' , kwargs , _freqplot_defaults , pop = True )
185+ deg = config ._get_param (
186+ 'freqplot' , 'deg' , kwargs , _freqplot_defaults , pop = True )
187+ Hz = config ._get_param (
188+ 'freqplot' , 'Hz' , kwargs , _freqplot_defaults , pop = True )
189+ grid = config ._get_param (
190+ 'freqplot' , 'grid' , kwargs , _freqplot_defaults , pop = True )
191+ plot = config ._get_param ('freqplot' , 'plot' , plot , True )
192+ margins = config ._get_param (
193+ 'freqplot' , 'margins' , margins , False )
193194 wrap_phase = config ._get_param (
194- 'bode ' , 'wrap_phase' , kwargs , _bode_defaults , pop = True )
195+ 'freqplot ' , 'wrap_phase' , kwargs , _freqplot_defaults , pop = True )
195196 initial_phase = config ._get_param (
196- 'bode ' , 'initial_phase' , kwargs , None , pop = True )
197+ 'freqplot ' , 'initial_phase' , kwargs , None , pop = True )
197198 omega_num = config ._get_param ('freqplot' , 'number_of_samples' , omega_num )
198199 # If argument was a singleton, turn it into a tuple
199200 if not hasattr (syslist , '__iter__' ):
@@ -937,9 +938,12 @@ def gangof4_plot(P, C, omega=None, **kwargs):
937938 "Gang of four is currently only implemented for SISO systems." )
938939
939940 # Get the default parameter values
940- dB = config ._get_param ('bode' , 'dB' , kwargs , _bode_defaults , pop = True )
941- Hz = config ._get_param ('bode' , 'Hz' , kwargs , _bode_defaults , pop = True )
942- grid = config ._get_param ('bode' , 'grid' , kwargs , _bode_defaults , pop = True )
941+ dB = config ._get_param (
942+ 'freqplot' , 'dB' , kwargs , _freqplot_defaults , pop = True )
943+ Hz = config ._get_param (
944+ 'freqplot' , 'Hz' , kwargs , _freqplot_defaults , pop = True )
945+ grid = config ._get_param (
946+ 'freqplot' , 'grid' , kwargs , _freqplot_defaults , pop = True )
943947
944948 # Compute the senstivity functions
945949 L = P * C
@@ -1094,11 +1098,11 @@ def singular_values_plot(syslist, omega=None,
10941098
10951099 # Get values for params (and pop from list to allow keyword use in plot)
10961100 dB = config ._get_param (
1097- 'singular_values_plot ' , 'dB' , kwargs , _singular_values_plot_default , pop = True )
1101+ 'freqplot ' , 'dB' , kwargs , _singular_values_plot_default , pop = True )
10981102 Hz = config ._get_param (
1099- 'singular_values_plot ' , 'Hz' , kwargs , _singular_values_plot_default , pop = True )
1103+ 'freqplot ' , 'Hz' , kwargs , _singular_values_plot_default , pop = True )
11001104 grid = config ._get_param (
1101- 'singular_values_plot ' , 'grid' , kwargs , _singular_values_plot_default , pop = True )
1105+ 'freqplot ' , 'grid' , kwargs , _singular_values_plot_default , pop = True )
11021106 plot = config ._get_param (
11031107 'singular_values_plot' , 'plot' , plot , True )
11041108 omega_num = config ._get_param ('freqplot' , 'number_of_samples' , omega_num )
@@ -1262,7 +1266,7 @@ def _determine_omega_vector(syslist, omega_in, omega_limits, omega_num, Hz):
12621266 np .log10 (omega_limits [1 ]),
12631267 num = omega_num , endpoint = True )
12641268 else :
1265- omega_out = np .asarray (omega_in )
1269+ omega_out = np .copy (omega_in )
12661270 if Hz :
12671271 omega_out *= 2. * math .pi
12681272 return omega_out , omega_range_given
0 commit comments