Skip to content
Snippets Groups Projects
Commit 72783df7 authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

reset plot_cavitydata and ImpedanceModel to stable

parent ed5e7f13
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
#from matplotlib import colormaps
from matplotlib import colormaps
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from scipy.integrate import trapz
from scipy.interpolate import interp1d
......
......@@ -1220,7 +1220,6 @@ def plot_cavitydata(filename,
bunch_number=0,
turn=None,
cm_lim=None,
max = False,
show_objective=False):
"""
Plot data recorded by CavityMonitor.
......@@ -1274,10 +1273,6 @@ def plot_cavitydata(filename,
cavity_data = file[cavity_name]
time = np.array(cavity_data["time"])
if max :
maxT = np.max(np.nonzero(time))-1
else:
maxT = len(time)
ph = {"cavity": 0, "beam": 1, "generator": 2, "ig": 3}
labels = ["Cavity", "Beam", "Generator", "Generator"]
......@@ -1312,21 +1307,21 @@ def plot_cavitydata(filename,
fig, ax = plt.subplots()
twin = ax.twinx()
p1, = ax.plot(time[:maxT],
np.abs(data[ph[phasor]][:maxT]) * units_val[ph[phasor]],
p1, = ax.plot(time,
np.abs(data[ph[phasor]]) * units_val[ph[phasor]],
color="r",
label=ylabel1)
p2, = twin.plot(time[:maxT],
np.angle(data[ph[phasor]])[:maxT],
p2, = twin.plot(time,
np.angle(data[ph[phasor]]),
color="b",
label=ylabel2)
if show_objective:
o1, = ax.plot(time[:maxT],
np.array(cavity_data["Vc"][:maxT]) * 1e-6,
o1, = ax.plot(time,
np.array(cavity_data["Vc"]) * 1e-6,
"r--",
label="Cavity voltage objective value [MV]")
o2, = twin.plot(time[:maxT],
np.array(cavity_data["theta"][:maxT]),
o2, = twin.plot(time,
np.array(cavity_data["theta"]),
"b--",
label="Cavity phase objective value [rad]")
ax.set_xlabel("Turn number")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment