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

Merge branch 'Courant-Snyder' into develop

parents f427a152 1bae2f53
No related branches found
No related tags found
No related merge requests found
...@@ -21,11 +21,12 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean", ...@@ -21,11 +21,12 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean",
---------- ----------
filenames : str or list of str filenames : str or list of str
Names of the HDF5 files to be plotted. Names of the HDF5 files to be plotted.
dataset : {"current","emit","mean","std"} dataset : {"current","emit","mean","std","cs_invariant"}
HDF5 file's dataset to be plotted. The default is "mean". HDF5 file's dataset to be plotted. The default is "mean".
dimension : str dimension : str
The dimension of the dataset to plot: The dimension of the dataset to plot:
for "emit", dimension = {"x","y","s"}, for "emit", dimension = {"x","y","s"},
for "cs_invariant", dimension = {"x","y"},
for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"}. for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"}.
not used if "current". not used if "current".
The default is "tau". The default is "tau".
...@@ -76,6 +77,15 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean", ...@@ -76,6 +77,15 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean",
elif stat_var == "std": elif stat_var == "std":
y = np.nanstd(data[axis,bunch_index,:],0) y = np.nanstd(data[axis,bunch_index,:],0)
y_label = stat_var + " " + label[axis] y_label = stat_var + " " + label[axis]
elif dataset == "cs_invariant":
dimension_dict = {"x":0, "y":1}
axis = dimension_dict[dimension]
label = ['$J_x$ (m)', '$J_y$ (m)']
if stat_var == "mean":
y = np.nanmean(data[axis,bunch_index,:],0)
elif stat_var == "std":
y = np.nanstd(data[axis,bunch_index,:],0)
y_label = stat_var + " " + label[axis]
elif dataset == "mean" or dataset == "std": elif dataset == "mean" or dataset == "std":
dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4, dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4,
"delta":5} "delta":5}
...@@ -112,6 +122,12 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean", ...@@ -112,6 +122,12 @@ def plot_beamdata(filenames, dataset="mean", dimension="tau", stat_var="mean",
"$\\epsilon_{s}$ (m.rad)"] "$\\epsilon_{s}$ (m.rad)"]
y = data[axis,:,idx] y = data[axis,:,idx]
y_label = label[axis] y_label = label[axis]
elif dataset == "cs_invariant":
dimension_dict = {"x":0, "y":1}
axis = dimension_dict[dimension]
label = ['$J_x$ (m)', '$J_y$ (m)']
y = data[axis,:,idx]
y_label = label[axis]
elif dataset == "mean" or dataset == "std": elif dataset == "mean" or dataset == "std":
dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4, dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4,
"delta":5} "delta":5}
...@@ -144,11 +160,12 @@ def streak_beamdata(filename, dataset="mean", dimension="tau", cm_lim=None): ...@@ -144,11 +160,12 @@ def streak_beamdata(filename, dataset="mean", dimension="tau", cm_lim=None):
---------- ----------
filename : str filename : str
Name of the HDF5 file that contains the data. Name of the HDF5 file that contains the data.
dataset : {"current","emit","mean","std"} dataset : {"current","emit","mean","std","cs_invariant"}
HDF5 file's dataset to be plotted. The default is "mean". HDF5 file's dataset to be plotted. The default is "mean".
dimension : str dimension : str
The dimension of the dataset to plot: The dimension of the dataset to plot:
for "emit", dimension = {"x","y","s"}, for "emit", dimension = {"x","y","s"},
for "cs_invariant", dimension = {"x","y"},
for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"}. for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"}.
not used if "current". not used if "current".
The default is "tau". The default is "tau".
...@@ -184,6 +201,13 @@ def streak_beamdata(filename, dataset="mean", dimension="tau", cm_lim=None): ...@@ -184,6 +201,13 @@ def streak_beamdata(filename, dataset="mean", dimension="tau", cm_lim=None):
z = np.array(data["emit"][axis,:,:]).T z = np.array(data["emit"][axis,:,:]).T
z_label = label[axis] z_label = label[axis]
title = z_label title = z_label
elif dataset == "cs_invariant":
dimension_dict = {"x":0, "y":1}
axis = dimension_dict[dimension]
label = ['$J_x$ (m)', '$J_y$ (m)']
z = np.array(data["cs_invariant"][axis,:,:]).T
z_label = label[axis]
title = z_label
else: else:
dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4, dimension_dict = {"x":0, "xp":1, "y":2, "yp":3, "tau":4,
"delta":5} "delta":5}
...@@ -237,6 +261,7 @@ def plot_bunchdata(filenames, bunch_number, dataset, dimension="x", ...@@ -237,6 +261,7 @@ def plot_bunchdata(filenames, bunch_number, dataset, dimension="x",
The dimension of the dataset to plot. Use "None" for "current", The dimension of the dataset to plot. Use "None" for "current",
otherwise use the following : otherwise use the following :
for "emit", dimension = {"x","y","s"}, for "emit", dimension = {"x","y","s"},
for "cs_invariant", dimension = {"x","y"},
for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"}, for "mean" and "std", dimension = {"x","xp","y","yp","tau","delta"},
for "action", dimension = {"x","y"}. for "action", dimension = {"x","y"}.
legend : list of str, optional legend : list of str, optional
......
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