diff --git a/mbtrack2/tracking/monitors/plotting.py b/mbtrack2/tracking/monitors/plotting.py index d59d35996a2b5854502d3b8406736f34be49f22e..5f256b91974cc7b73bc0f2a5bbe2f1593af40116 100644 --- a/mbtrack2/tracking/monitors/plotting.py +++ b/mbtrack2/tracking/monitors/plotting.py @@ -1076,7 +1076,7 @@ def streak_beamspectrum(filename, dim="tau", f0=None, log_scale=True, fmin=None, return fig def plot_cavitydata(filename, cavity_name, phasor="cavity", - plot_type="mean", bunch_number=0, turn=None, cm_lim=None, + plot_type="bunch", bunch_number=0, turn=None, cm_lim=None, show_objective=False): """ Plot data recorded by CavityMonitor. @@ -1092,8 +1092,6 @@ def plot_cavitydata(filename, cavity_name, phasor="cavity", "ig". plot_type : str, optional Type of plot: - - "mean" plots the mean phasor voltage and angle versus time for - non empty bunches. - "bunch" plots the phasor voltage and angle versus time for a given bunch. - "turn" plots the phasor voltage and ange versus bunch index for @@ -1104,7 +1102,11 @@ def plot_cavitydata(filename, cavity_name, phasor="cavity", time. - "detune" or "psi" plots the detuning or tuning angle versus time. - "power" plots the generator, cavity, beam and reflected power - versus time. + versus time. Needs BeamMonitor data with same save_every as + CavityMonitor. + - "mean" plots the mean phasor voltage and angle versus time for + non empty bunches. Needs BeamMonitor data with same save_every as + CavityMonitor. bunch_number : int, optional Bunch number to select. The default is 0. turn : int, optional @@ -1143,7 +1145,7 @@ def plot_cavitydata(filename, cavity_name, phasor="cavity", try: bunch_index = (file["Beam"]["current"][:,0] != 0).nonzero()[0] except: - print("Beam monitor is needed to show mean voltage.") + ValueError("Beam monitor is needed to show mean voltage.") data = [np.mean(cavity_data["cavity_phasor_record"][bunch_index,:],0), np.mean(cavity_data["beam_phasor_record"][bunch_index,:],0), np.mean(cavity_data["generator_phasor_record"][bunch_index,:],0),