In [ ]:
Copied!
from genesis import parsers
from genesis import parsers
In [ ]:
Copied!
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams["figure.figsize"] = [8, 8]
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams["figure.figsize"] = [8, 8]
%config InlineBackend.figure_format = 'retina'
In [ ]:
Copied!
fname = "data/mod_3.out"
# This parses the entier outfile
gout = parsers.parse_genesis_out(fname)
# This is a dict of:
gout.keys()
fname = "data/mod_3.out"
# This parses the entier outfile
gout = parsers.parse_genesis_out(fname)
# This is a dict of:
gout.keys()
In [ ]:
Copied!
# param is the readback of the basic paramters:
list(gout["param"])[0:10]
# param is the readback of the basic paramters:
list(gout["param"])[0:10]
In [ ]:
Copied!
# Data contains the lattice readback arrays, slice data, and possibly field and particle data
data = gout["data"]
for k in data:
    print(k, data[k].shape)
# Data contains the lattice readback arrays, slice data, and possibly field and particle data
data = gout["data"]
for k in data:
    print(k, data[k].shape)
In [ ]:
Copied!
z = data["z"]
for i in range(len(data["index"])):
    power = data["power"][i, :]
    plt.plot(z, power)
z = data["z"]
for i in range(len(data["index"])):
    power = data["power"][i, :]
    plt.plot(z, power)
Plotting¶
In [ ]:
Copied!
x1 = gout["data"]["z"]
x2 = gout["data"]["z"]
y1 = gout["data"]["aw"]
y2 = gout["data"]["qfld"]
plt.subplot(2, 1, 1)
plt.plot(x1, y1, "o-")
plt.title("Lattice")
plt.ylabel("qw")
plt.subplot(2, 1, 2)
plt.plot(x2, y2, ".-")
plt.xlabel("z (m)")
plt.ylabel("qfld")
plt.show()
x1 = gout["data"]["z"]
x2 = gout["data"]["z"]
y1 = gout["data"]["aw"]
y2 = gout["data"]["qfld"]
plt.subplot(2, 1, 1)
plt.plot(x1, y1, "o-")
plt.title("Lattice")
plt.ylabel("qw")
plt.subplot(2, 1, 2)
plt.plot(x2, y2, ".-")
plt.xlabel("z (m)")
plt.ylabel("qfld")
plt.show()