Skip to content
Snippets Groups Projects
Commit baf3f141 authored by Vadim Gubaidulin's avatar Vadim Gubaidulin
Browse files

New method to plot risetimes and damptimes vs the bunchnumber

parent 4513384e
No related branches found
No related tags found
No related merge requests found
......@@ -188,15 +188,55 @@ class BBDataViewer():
# ax.plot(signal)
# min_level = np.min((10.*np.mean(signal[:200]), 10.*np.mean(signal[-200:])))
risetime = fit_risetime(signal,
damptime = fit_risetime(signal,
min_level=min_level,
smoothing_window_size=smoothing_window_size,
matplotlib_axis=ax)
ax.set_xlim(0,)
ax.set_xlabel('Time (arb. units)')
ax.set_ylabel(r'Beam c.\,m. offset (arb. units)')
ax.set_title(f'Fitted damptime {risetime:.2f} turns')
ax.set_title(f'Fitted damptime {damptime:.2f} turns')
return damptime
def plot_risetimes(self, ax=None, plane='y', smoothing_window_size=10,
min_level=15):
risetimes = np.zeros(shape=(self.h_rf))
for i in range(self.h_rf):
if plane == 'y':
signal = np.abs(hilbert(self.data_bunch_y[i, :]))
elif plane == 'x':
signal = np.abs(hilbert(self.data_bunch_x[i, :]))
else:
raise ValueError('Plane must be defined as x or y.')
risetimes[i] = fit_risetime(signal,
min_level=min_level,
smoothing_window_size=smoothing_window_size,
matplotlib_axis=ax)
if ax == None:
_, ax = plt.subplots(1, 1)
ax.plot(risetimes)
return risetimes
def plot_damptimes(self, ax=None, plane='y', smoothing_window_size=10,
min_level=15):
damptimes = np.zeros(shape=(self.h_rf))
for i in range(self.h_rf):
if plane == 'y':
signal = np.abs(hilbert(self.data_bunch_y[i, :]))
elif plane == 'x':
signal = np.abs(hilbert(self.data_bunch_x[i, :]))
else:
raise ValueError('Plane must be defined as x or y.')
damptimes[i] = fit_risetime(signal,
min_level=min_level,
smoothing_window_size=smoothing_window_size,
matplotlib_axis=ax)
if ax == None:
_, ax = plt.subplots(1, 1)
ax.plot(damptimes)
return damptimes
def plot_filling_pattern(self, ax=None):
if ax == None:
_, ax = plt.subplots(1, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment