120
120
Ω_range,
121
121
branch::Int,
122
122
y_offset::String="0.0",
123
- y_center::Float64=0.0,
124
123
x_scale=1.0,
125
124
y_scale=1.0,
126
125
logscale=false)
@@ -130,7 +129,7 @@ Performs one matrix diagonalization for each element of `Ω_range`.
130
129
This method is faster than `plot_response` but results in errors where the noise frequency
131
130
is far from the frequency of the harmonic variables.
132
131
"""
133
- function plot_jacobian_spectrum (res:: Result , nat_var:: Num ; Ω_range, branch:: Int , y_offset:: String = " 0.0" , y_center :: Float64 = 0.0 , x_scale= 1.0 , y_scale= 1.0 , logscale= false )
132
+ function plot_jacobian_spectrum (res:: Result , nat_var:: Num ; Ω_range, branch:: Int , y_offset:: String = " 0.0" , x_scale= 1.0 , y_scale= 1.0 , logscale= false )
134
133
135
134
136
135
length (size (res. solutions)) != 1 && error (" 1D plots of not-1D datasets are usually a bad idea." )
@@ -140,19 +139,20 @@ function plot_jacobian_spectrum(res::Result, nat_var::Num; Ω_range, branch::Int
140
139
X = Vector {Float64} (collect (values (res. swept_parameters))[1 ][stability])
141
140
142
141
offset = Vector {Float64} (getindex .(transform_solutions (res, y_offset), branch))[stability]
143
-
142
+
144
143
# only get spectra of the stable points!
145
144
spectra = [JacobianSpectrum (res, branch= branch, index = i) for i in (1 : length (res. solutions))[stability]]
146
- Y = Array {Float64, 2} (undef, length (Ω_range), length (X))
145
+ C = Array {Float64, 2} (undef, length (Ω_range)- 1 , length (X)- 1 )
147
146
148
- for ij in CartesianIndices (Y )
149
- Y [ij] = abs (evaluate (spectra[ij[2 ]][nat_var], reverse ( Ω_range) [ij[1 ]] - (y_center - offset[ij[2 ]]) ))
147
+ for ij in CartesianIndices (C )
148
+ C [ij] = abs (evaluate (spectra[ij[2 ]][nat_var], Ω_range[ij[1 ]] - offset[ij[2 ]]))
150
149
end
151
- X = x_scale .* X
152
- Y = logscale ? log .(Y) : Y
153
- Ω_range, y_center = y_scale .* Ω_range, y_scale * y_center
154
- plt = PyPlot. imshow (Y, aspect= " auto" , extent= [X[1 ], X[end ], Ω_range[1 ]- y_center, Ω_range[end ]- y_center])
150
+ x_mat = x_scale * hcat ([x* ones (length (Ω_range)) for x in X]. .. )
151
+ y_mat = y_scale * hcat ([Ω_range for j= 1 : length (X)]. .. )
152
+ C = logscale ? log .(C) : C
153
+
154
+ PyPlot. pcolormesh (x_mat, y_mat, C)
155
155
xlabel (Latexify. latexify (string (first (keys (res. swept_parameters)))));
156
- ylabel (" noise angular frequency - " * y_offset);
157
- return plt
156
+ ylabel (" noise angular frequency - " * latexify ( y_offset) );
157
+ return C
158
158
end
0 commit comments