Skip to content
Snippets Groups Projects

Fixing matplotlib future warnings

Closed Oleksandr Naumenko requested to merge onaumenk/BLonD:warning_message_plot_beams into master
4 files
+ 210
133
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 33
25
@@ -21,7 +21,6 @@ from ..plots.plot_beams import *
from ..plots.plot_slices import *
from ..plots.plot_llrf import *
def fig_folder(dirname):
'''
Create folder where plots will be stored.
@@ -42,7 +41,8 @@ def fig_folder(dirname):
class Plot(object):
def __init__(self, Ring, RFStation, Beam, dt_plot,
dt_bckp, xmin, xmax, ymin, ymax, xunit = 's', sampling = 1,
dt_bckp, xmin, xmax, ymin, ymax, xunit = 's', sampling = 1,
show_plots = False,
separatrix_plot = False, histograms_plot = True,
Profile = None, h5file = None, output_frequency = 1,
PhaseLoop = None, LHCNoiseFB = None, format_options = None):
@@ -56,6 +56,7 @@ class Plot(object):
in units of time steps.
'''
#: | *Import Ring*
self.general_params = Ring
@@ -67,7 +68,10 @@ class Plot(object):
#: | *Import Beam*
self.beam = Beam
#: | *Defining whether the plots should be saved or directly shown*
self.show_plt = show_plots
#: | *Plotting frequency in units of time steps*
self.dt_plot = dt_plot
self.dt_bckp = dt_bckp
@@ -192,9 +196,12 @@ class Plot(object):
plt.rc('lines', linewidth=self.lwidth, markersize=self.msize)
# Set figure resolution, font
plt.rc('figure', dpi=self.dpi)
plt.rc('savefig', dpi=self.dpi)
plt.rc('font', family=self.ffamily)
plt.rc('figure', dpi=self.dpi)
plt.rc('figure', autolayout = True)
plt.rc('savefig', dpi=self.dpi)
plt.rc('savefig', bbox='tight')
plt.rc('savefig', pad_inches = 0.1)
plt.rc('font', family=self.ffamily)
def track(self):
@@ -211,16 +218,17 @@ class Plot(object):
sampling = self.sampling,
separatrix_plot = self.separatix,
histograms_plot = self.histogram,
dirname = self.dirname, alpha = self.alpha)
dirname = self.dirname, show_plot=self.show_plt,
alpha = self.alpha)
if self.profile:
plot_beam_profile(self.profile, self.tstep[0],
style = self.lstyle, dirname = self.dirname)
style = self.lstyle, dirname = self.dirname, show_plot = self.show_plt)
self.profile.beam_spectrum_freq_generation(self.profile.n_slices)
self.profile.beam_spectrum_generation(self.profile.n_slices)
plot_beam_spectrum(self.profile, self.tstep[0],
style = self.lstyle, dirname = self.dirname)
style = self.lstyle, dirname = self.dirname, show_plot = self.show_plt)
# Plots as a function of time
if (self.tstep[0] % self.dt_bckp) == 0 and self.h5file:
@@ -228,60 +236,60 @@ class Plot(object):
h5data = hp.File(self.h5file + '.h5', 'r')
plot_bunch_length_evol(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
if self.profile and self.profile.fit_option == 'gaussian':
plot_bunch_length_evol_gaussian(self.rf_params, self.profile,
h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
plot_position_evol(self.rf_params, h5data,
output_freq = self.dt_mon,
style = self.lstyle, dirname = self.dirname)
style = self.lstyle, dirname = self.dirname, show_plot=self.show_plt)
plot_energy_evol(self.rf_params, h5data, output_freq = self.dt_mon,
style = self.lstyle, dirname = self.dirname)
style = self.lstyle, dirname = self.dirname,show_plot=self.show_plt)
plot_COM_motion(self.general_params, self.rf_params, h5data,
output_freq = self.dt_mon, dirname = self.dirname)
output_freq = self.dt_mon, dirname = self.dirname, show_plot=self.show_plt)
plot_transmitted_particles(self.rf_params, h5data,
output_freq = self.dt_mon,
style = self.lstyle,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
if self.PL:
plot_PL_RF_freq(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
plot_PL_RF_phase(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
plot_PL_bunch_phase(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
plot_PL_phase_corr(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname,show_plot=self.show_plt)
plot_PL_freq_corr(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname,show_plot=self.show_plt)
plot_RF_phase_error(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname,show_plot=self.show_plt)
plot_RL_radial_error(self.rf_params, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname,show_plot=self.show_plt)
if self.noiseFB:
plot_LHCNoiseFB(self.rf_params, self.noiseFB, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
plot_LHCNoiseFB_FWHM(self.rf_params, self.noiseFB, h5data,
output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
if self.noiseFB.bl_meas_bbb != None:
plot_LHCNoiseFB_FWHM_bbb(self.rf_params, self.noiseFB,
h5data, output_freq = self.dt_mon,
dirname = self.dirname)
dirname = self.dirname, show_plot=self.show_plt)
h5data.close()
Loading