From f980290cfe8bf7f2787d2b9cccdb440f01683c2b Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <gamelin@synchrotron-soleil.fr> Date: Wed, 30 Sep 2020 16:05:43 +0200 Subject: [PATCH] Bugfix Correct scale in plot_wakedata Avoid circular import by moving import in function --- collective_effects/wakefield.py | 3 +++ tracking/monitors/plotting.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/collective_effects/wakefield.py b/collective_effects/wakefield.py index 645a9f2..01fa913 100644 --- a/collective_effects/wakefield.py +++ b/collective_effects/wakefield.py @@ -488,6 +488,9 @@ class Impedance(ComplexData): positive_index = self.data.index > 0 frequency = self.data.index[positive_index] + + # Import here to avoid circular import + from mbtrack2.collective_effects.utilities import spectral_density sd = spectral_density(frequency, sigma, m=0) if(self.impedance_type == "long"): diff --git a/tracking/monitors/plotting.py b/tracking/monitors/plotting.py index 7f74c63..de90791 100644 --- a/tracking/monitors/plotting.py +++ b/tracking/monitors/plotting.py @@ -462,7 +462,7 @@ def plot_wakedata(filename, bunch_number, wake_type="Wlong", start=0, if streak_plot is True: turn = np.reshape(path['time'][turn_index_array], (num+1,1)) y_var = np.ones((num+1,n_bin)) * turn - z_var = np.transpose(path[wake_type][:,turn_index_array]) + z_var = np.transpose(path[wake_type][:,turn_index_array]*scale[dimension_dict[wake_type]]) fig2, ax2 = plt.subplots() cmap = mpl.cm.cool c = ax2.imshow(z_var, cmap=cmap, origin='lower' , aspect='auto', -- GitLab