QuickstartĀ¶
InĀ [1]:
Copied!
import matplotlib.pyplot as plt
from genesis.version4 import Genesis4
import genesis.version4 as g4
%config InlineBackend.figure_format = 'retina' # Nicer plots
import matplotlib.pyplot as plt
from genesis.version4 import Genesis4
import genesis.version4 as g4
%config InlineBackend.figure_format = 'retina' # Nicer plots
Load an existing main input file and run Genesis4Ā¶
Load a pre-existing Genesis 4 main input file - "Example 1: Steady State" from Sven's documentation. The lattice file will be determined automatically from its &setup
namelist.
InĀ [2]:
Copied!
G = Genesis4("data/example1-steadystate/Example1.in")
G.verbose = True
G = Genesis4("data/example1-steadystate/Example1.in")
G.verbose = True
InĀ [3]:
Copied!
output = G.run()
output = G.run()
Configured to run in: /tmp/tmp3m9ortxp Running Genesis4 in /tmp/tmp3m9ortxp /home/runner/miniconda3/envs/lume-genesis-dev/bin/genesis4 -l Example1.lat genesis4.in --------------------------------------------- GENESIS - Version 4.6.6 has started... Compile info: Compiled by conda at 2024-06-10 16:25:29 [UTC] from Git Commit ID: 07004e4cb437003b4b6cf024122db18caee13722 Starting Time: Thu Aug 29 16:19:50 2024 MPI-Comm Size: 1 node Opened input file genesis4.in Parsing lattice file Example1.lat ... Matching for periodic solution between z = 0 and z = 9.5 : betax (m) : 8.53711 alphax : -0.703306 phix (deg): 45.818 betay (m) : 17.3899 alphay : 1.40348 phiy (deg): 45.818 Generating input radiation field for HARM = 1 ... Generating input particle distribution... Running Core Simulation... Steady-state run Initial analysis of electron beam and radiation field... Calculation: 0% done
Calculation: 10% done
Calculation: 20% done
Calculation: 30% done
Calculation: 40% done
Calculation: 50% done
Calculation: 60% done
Calculation: 70% done
Calculation: 80% done
Calculation: 90% done
Calculation: 100% done Writing output file... Core Simulation done. End of Track Program is terminating... Ending Time: Thu Aug 29 16:19:57 2024 Total Wall Clock Time: 7.14937 seconds ------------------------------------- Success - execution took 7.18s.
LUME-Genesis offers a plotting helpers on the Genesis4 object (and Genesis4Output
itself) to work with the output data.
You can specify individual data keys to plot the output data and the layout below.
InĀ [4]:
Copied!
G.plot(["beam_xsize", "beam_ysize", "field_xsize", "field_ysize"])
G.plot(["beam_xsize", "beam_ysize", "field_xsize", "field_ysize"])
InĀ [5]:
Copied!
output.lattice.plot();
output.lattice.plot();
Beam and field sizesĀ¶
InĀ [6]:
Copied!
zplot = output.lattice.zplot
field = output.field
plt.plot(zplot, output.beam.xsize * 1e6, label=r"Beam: $\sigma_x$")
plt.plot(zplot, output.beam.ysize * 1e6, label=r"Beam: $\sigma_y$")
plt.plot(zplot, field.xsize * 1e6, label=r"Field: $\sigma_x$")
plt.plot(zplot, field.ysize * 1e6, label=r"Field: $\sigma_y$")
plt.legend()
plt.xlabel(r"$z$ (m)")
plt.ylabel(r"$\sigma_{x,y}$ ($\mu$m)")
plt.ylim([0, 60])
plt.show()
zplot = output.lattice.zplot
field = output.field
plt.plot(zplot, output.beam.xsize * 1e6, label=r"Beam: $\sigma_x$")
plt.plot(zplot, output.beam.ysize * 1e6, label=r"Beam: $\sigma_y$")
plt.plot(zplot, field.xsize * 1e6, label=r"Field: $\sigma_x$")
plt.plot(zplot, field.ysize * 1e6, label=r"Field: $\sigma_y$")
plt.legend()
plt.xlabel(r"$z$ (m)")
plt.ylabel(r"$\sigma_{x,y}$ ($\mu$m)")
plt.ylim([0, 60])
plt.show()
Make your own inputĀ¶
This section replicates the above Genesis 4-format input entirely in Python.
InĀ [7]:
Copied!
main = g4.MainInput(
[
g4.Setup(
rootname="Example1",
beamline="FEL",
gamma0=11357.82,
delz=0.045,
nbins=8,
shotnoise=False,
),
g4.LatticeNamelist(zmatch=9.5),
g4.Field(power=5000.0, waist_size=3e-05, dgrid=0.0002, ngrid=255),
g4.Beam(delgam=1.0, current=3000.0, ex=4e-07, ey=4e-07),
g4.Track(),
],
)
lattice = g4.Lattice(
{
"D1": g4.Drift(L=0.44),
"D2": g4.Drift(L=0.24),
"FEL": g4.Line(elements=["FODO"] * 6),
"FODO": g4.Line(
elements=["UND", "D1", "QF", "D2", "UND", "D1", "QD", "D2"],
),
"QD": g4.Quadrupole(L=0.08, k1=-2.0),
"QF": g4.Quadrupole(L=0.08, k1=2.0),
"UND": g4.Undulator(aw=0.84853, lambdau=0.015, nwig=266, helical=True),
}
)
main = g4.MainInput(
[
g4.Setup(
rootname="Example1",
beamline="FEL",
gamma0=11357.82,
delz=0.045,
nbins=8,
shotnoise=False,
),
g4.LatticeNamelist(zmatch=9.5),
g4.Field(power=5000.0, waist_size=3e-05, dgrid=0.0002, ngrid=255),
g4.Beam(delgam=1.0, current=3000.0, ex=4e-07, ey=4e-07),
g4.Track(),
],
)
lattice = g4.Lattice(
{
"D1": g4.Drift(L=0.44),
"D2": g4.Drift(L=0.24),
"FEL": g4.Line(elements=["FODO"] * 6),
"FODO": g4.Line(
elements=["UND", "D1", "QF", "D2", "UND", "D1", "QD", "D2"],
),
"QD": g4.Quadrupole(L=0.08, k1=-2.0),
"QF": g4.Quadrupole(L=0.08, k1=2.0),
"UND": g4.Undulator(aw=0.84853, lambdau=0.015, nwig=266, helical=True),
}
)
InĀ [8]:
Copied!
G = Genesis4(main, lattice)
G.verbose = True
G = Genesis4(main, lattice)
G.verbose = True
InĀ [9]:
Copied!
output = G.run()
output = G.run()
Configured to run in: /tmp/tmpsbpj1jmj Running Genesis4 in /tmp/tmpsbpj1jmj /home/runner/miniconda3/envs/lume-genesis-dev/bin/genesis4 -l genesis.lat genesis4.in --------------------------------------------- GENESIS - Version 4.6.6 has started... Compile info: Compiled by conda at 2024-06-10 16:25:29 [UTC] from Git Commit ID: 07004e4cb437003b4b6cf024122db18caee13722 Starting Time: Thu Aug 29 16:19:58 2024 MPI-Comm Size: 1 node Opened input file genesis4.in Parsing lattice file genesis.lat ... Matching for periodic solution between z = 0 and z = 9.5 : betax (m) : 8.53711 alphax : -0.703306 phix (deg): 45.818 betay (m) : 17.3899 alphay : 1.40348 phiy (deg): 45.818 Generating input radiation field for HARM = 1 ... Generating input particle distribution... Running Core Simulation... Steady-state run Initial analysis of electron beam and radiation field... Calculation: 0% done
Calculation: 10% done
Calculation: 20% done
Calculation: 30% done
Calculation: 40% done
Calculation: 50% done
Calculation: 60% done
Calculation: 70% done
Calculation: 80% done
Calculation: 90% done
Calculation: 100% done Writing output file... Core Simulation done. End of Track Program is terminating... Ending Time: Thu Aug 29 16:20:05 2024 Total Wall Clock Time: 7.00207 seconds ------------------------------------- Success - execution took 7.03s.
InĀ [10]:
Copied!
G.plot(["beam_xsize", "beam_ysize", "field_xsize", "field_ysize"])
G.plot(["beam_xsize", "beam_ysize", "field_xsize", "field_ysize"])
View available output dataĀ¶
InĀ [11]:
Copied!
output.info()
output.info()
Out[11]:
Key | Units | Shape | Description |
---|---|---|---|
alphax | rad | (1, 1) | Twiss alpha horizontal. Evaluated only at the beginning. [rad] |
alphay | rad | (1, 1) | Twiss alpha vertical. Evaluated only at the beginning. [rad] |
aw | (1104,) | The dimensionless rms undulator parameter. For planar undulator this value is smaller by a factor $1 / \sqrt{2}$ than its K-value, while for helical undulator rms and peak values are identical. | |
ax | m | (1104,) | Offset of the undulator module in $x$ in meter. |
ay | m | (1104,) | Offset of the undulator module in $y$ in meter. |
beam_alphax | rad | (1, 1) | Twiss alpha horizontal. Evaluated only at the beginning. [rad] |
beam_alphay | rad | (1, 1) | Twiss alpha vertical. Evaluated only at the beginning. [rad] |
beam_betax | m | (1, 1) | Twiss beta horizontal. Evaluated only at the beginning. [m] |
beam_betay | m | (1, 1) | Twiss beta vertical. Evaluated only at the beginning. [m] |
beam_bunching | (1105, 1) | Evaluated at each integration step. [unitless] | |
beam_bunchingphase | rad | (1105, 1) | Evaluated at each integration step. [rad] |
beam_current | A | (1105, 1) | Beam current. Evaluated only at the beginning. [A] |
beam_efield | eV/m | (1105, 1) | Efield, internally eloss+longESC [eV/m] |
beam_emax | eV | (1105, 1) | Particle energy maximum. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
beam_emin | eV | (1105, 1) | Particle energy minimum. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
beam_emitx | m | (1, 1) | Beam horizontal emittance. Evaluated only at the beginning. [m] |
beam_emity | m | (1, 1) | Beam vertical emittance. Evaluated only at the beginning. [m] |
beam_energy | eV | (1105, 1) | Evaluated at each integration step. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
beam_energyspread | eV | (1105, 1) | Evaluated at each integration step. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
beam_globals_energy | (0,) | ||
beam_globals_energyspread | (0,) | ||
beam_globals_xposition | (0,) | ||
beam_globals_xsize | (0,) | ||
beam_globals_yposition | (0,) | ||
beam_globals_ysize | (0,) | ||
beam_lsc_field | eV/m | (1105, 1) | Longitudinal space charge [eV/m] |
beam_pxmax | rad | (1105, 1) | Particle horizontal maximum momentum [rad] |
beam_pxmin | rad | (1105, 1) | Particle horizontal minimum momentum [rad] |
beam_pxposition | rad | (1105, 1) | Particle horizontal position in momentum space [rad] |
beam_pymax | rad | (1105, 1) | Particle vertical maximum momentum [rad] |
beam_pymin | rad | (1105, 1) | Particle vertical minimum momentum [rad] |
beam_pyposition | rad | (1105, 1) | Particle vertical position in momentum space [rad] |
beam_sigma_energy | eV | (1105,) | |
beam_sigma_x | m | (1105,) | |
beam_sigma_y | m | (1105,) | |
beam_ssc_field | eV/m | (1105, 1) | Short-range space charge [eV/m] |
beam_stat_alphax | rad | (1105,) | |
beam_stat_alphay | rad | (1105,) | |
beam_stat_betax | m | (1105,) | |
beam_stat_betay | m | (1105,) | |
beam_stat_bunching | (1105,) | ||
beam_stat_bunchingphase | rad | (1105,) | |
beam_stat_current | A | (1105,) | |
beam_stat_efield | eV/m | (1105,) | |
beam_stat_emitx | m | (1105,) | |
beam_stat_emity | m | (1105,) | |
beam_stat_energy | eV | (1105,) | |
beam_stat_energyspread | eV | (1105,) | |
beam_stat_lsc_field | eV/m | (1105,) | |
beam_stat_pxmax | rad | (1105,) | |
beam_stat_pxmin | rad | (1105,) | |
beam_stat_pxposition | rad | (1105,) | |
beam_stat_pymax | rad | (1105,) | |
beam_stat_pymin | rad | (1105,) | |
beam_stat_pyposition | rad | (1105,) | |
beam_stat_sigma_energy | eV | (1105,) | |
beam_stat_sigma_x | m | (1105,) | |
beam_stat_sigma_y | m | (1105,) | |
beam_stat_ssc_field | eV/m | (1105,) | |
beam_stat_wakefield | eV/m | (1105,) | |
beam_stat_xmax | m | (1105,) | |
beam_stat_xmin | m | (1105,) | |
beam_stat_xposition | m | (1105,) | |
beam_stat_ymax | m | (1105,) | |
beam_stat_ymin | m | (1105,) | |
beam_stat_yposition | m | (1105,) | |
beam_wakefield | eV/m | (1105, 1) | Wakefield, internally the energy loss. [eV/m] |
beam_xmax | m | (1105, 1) | Particle horizontal maximum position [m] |
beam_xmin | m | (1105, 1) | Particle horizontal minimum position [m] |
beam_xposition | m | (1105, 1) | Partical horizontal position [m] |
beam_xsize | m | (1105, 1) | Beam horizontal sigma. [m] |
beam_ymax | m | (1105, 1) | Particle vertical maximum position [m] |
beam_ymin | m | (1105, 1) | Particle vertical minimum position [m] |
beam_yposition | m | (1105, 1) | Partical vertical position [m] |
beam_ysize | m | (1105, 1) | Beam horizontal sigma. [m] |
betax | m | (1, 1) | Twiss beta horizontal. Evaluated only at the beginning. [m] |
betay | m | (1, 1) | Twiss beta vertical. Evaluated only at the beginning. [m] |
bunching | (1105, 1) | Evaluated at each integration step. [unitless] | |
bunchingphase | rad | (1105, 1) | Evaluated at each integration step. [rad] |
chic_angle | degree | (1104,) | |
chic_lb | m | (1104,) | Length of an individual dipole in meter. |
chic_ld | m | (1104,) | Drift between the outer and inner dipoles, projected onto the undulator axis. The actual path length is longer by the factor $1/\cos\theta$, where $\theta$ is the bending angle of an individual dipole. |
chic_lt | m | (1104,) | |
current | A | (1105, 1) | Beam current. Evaluated only at the beginning. [A] |
cx | rad | (1104,) | Kick angle in $x$ in units of $\gamma \beta_x$. |
cy | rad | (1104,) | Kick angle in $y$ in units of $\gamma \beta_y$. |
dz | m | (1104,) | Step length |
efield | eV/m | (1105, 1) | Efield, internally eloss+longESC [eV/m] |
emax | eV | (1105, 1) | Particle energy maximum. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
emin | eV | (1105, 1) | Particle energy minimum. Genesis4 mc^2 units are automatically converted to eV in LUME-Genesis. |
emitx | m | (1, 1) | Beam horizontal emittance. Evaluated only at the beginning. [m] |
emity | m | (1, 1) | Beam vertical emittance. Evaluated only at the beginning. [m] |
field1_energy | J | (1105,) | Calculated by LUME-Genesis using slen from /Global. |
field1_globals_energy | (0,) | ||
field1_globals_intensity_farfield | (0,) | Field intensity in the far field [arb units] | |
field1_globals_intensity_nearfield | (0,) | Field intensity in the near field [arb units] | |
field1_globals_xdivergence | (0,) | Horizontal divergence [rad] | |
field1_globals_xpointing | (0,) | Horizontal pointing. [rad] | |
field1_globals_xposition | (0,) | Horizontal position. [m] | |
field1_globals_xsize | (0,) | Horizontal sigma. [m] | |
field1_globals_ydivergence | (0,) | Vertical divergence [rad] | |
field1_globals_ypointing | (0,) | Vertical pointing. [rad] | |
field1_globals_yposition | (0,) | Vertical position. [m] | |
field1_globals_ysize | (0,) | Vertical sigma. [m] | |
field1_intensity_farfield | W/rad^2 | (1105, 1) | Field intensity in the far field [arb units] |
field1_intensity_nearfield | W/m^2 | (1105, 1) | Field intensity in the near field [arb units] |
field1_peak_power | W | (1105,) | Peak power [W]. |
field1_phase_farfield | rad | (1105, 1) | Far field phase [rad] |
field1_phase_nearfield | rad | (1105, 1) | Near field phase [rad] |
field1_power | W | (1105, 1) | Power [W] |
field1_stat_energy | (1105,) | ||
field1_stat_intensity_farfield | (1105,) | ||
field1_stat_intensity_nearfield | (1105,) | ||
field1_stat_phase_farfield | (1105,) | ||
field1_stat_phase_nearfield | (1105,) | ||
field1_stat_power | (1105,) | ||
field1_stat_xdivergence | (1105,) | ||
field1_stat_xpointing | (1105,) | ||
field1_stat_xposition | (1105,) | ||
field1_stat_xsize | (1105,) | ||
field1_stat_ydivergence | (1105,) | ||
field1_stat_ypointing | (1105,) | ||
field1_stat_yposition | (1105,) | ||
field1_stat_ysize | (1105,) | ||
field1_xdivergence | rad | (1105, 1) | Horizontal divergence [rad] |
field1_xpointing | rad | (1105, 1) | Horizontal pointing. [rad] |
field1_xposition | m | (1105, 1) | Horizontal position. [m] |
field1_xsize | m | (1105, 1) | Horizontal sigma. [m] |
field1_ydivergence | rad | (1105, 1) | Vertical divergence [rad] |
field1_ypointing | rad | (1105, 1) | Vertical pointing. [rad] |
field1_yposition | m | (1105, 1) | Vertical position. [m] |
field1_ysize | m | (1105, 1) | Vertical sigma. [m] |
field_energy | J | (1105,) | Calculated by LUME-Genesis using slen from /Global. |
field_globals_energy | (0,) | ||
field_globals_intensity_farfield | (0,) | Field intensity in the far field [arb units] | |
field_globals_intensity_nearfield | (0,) | Field intensity in the near field [arb units] | |
field_globals_xdivergence | (0,) | Horizontal divergence [rad] | |
field_globals_xpointing | (0,) | Horizontal pointing. [rad] | |
field_globals_xposition | (0,) | Horizontal position. [m] | |
field_globals_xsize | (0,) | Horizontal sigma. [m] | |
field_globals_ydivergence | (0,) | Vertical divergence [rad] | |
field_globals_ypointing | (0,) | Vertical pointing. [rad] | |
field_globals_yposition | (0,) | Vertical position. [m] | |
field_globals_ysize | (0,) | Vertical sigma. [m] | |
field_intensity_farfield | W/rad^2 | (1105, 1) | Field intensity in the far field [arb units] |
field_intensity_nearfield | W/m^2 | (1105, 1) | Field intensity in the near field [arb units] |
field_peak_power | W | (1105,) | Peak power [W]. |
field_phase_farfield | rad | (1105, 1) | Far field phase [rad] |
field_phase_nearfield | rad | (1105, 1) | Near field phase [rad] |
field_power | W | (1105, 1) | Power [W] |
field_stat_energy | (1105,) | ||
field_stat_intensity_farfield | (1105,) | ||
field_stat_intensity_nearfield | (1105,) | ||
field_stat_phase_farfield | (1105,) | ||
field_stat_phase_nearfield | (1105,) | ||
field_stat_power | (1105,) | ||
field_stat_xdivergence | (1105,) | ||
field_stat_xpointing | (1105,) | ||
field_stat_xposition | (1105,) | ||
field_stat_xsize | (1105,) | ||
field_stat_ydivergence | (1105,) | ||
field_stat_ypointing | (1105,) | ||
field_stat_yposition | (1105,) | ||
field_stat_ysize | (1105,) | ||
field_xdivergence | rad | (1105, 1) | Horizontal divergence [rad] |
field_xpointing | rad | (1105, 1) | Horizontal pointing. [rad] |
field_xposition | m | (1105, 1) | Horizontal position. [m] |
field_xsize | m | (1105, 1) | Horizontal sigma. [m] |
field_ydivergence | rad | (1105, 1) | Vertical divergence [rad] |
field_ypointing | rad | (1105, 1) | Vertical pointing. [rad] |
field_yposition | m | (1105, 1) | Vertical position. [m] |
field_ysize | m | (1105, 1) | Vertical sigma. [m] |
frequency | eV | (1,) | Frequency [eV] |
globals_frequency | eV | (1,) | Frequency [eV] |
globals_s | m | (1,) | Longitudinal position [m] |
gradx | 1/m | (1104,) | Relative transverse gradient of undulator field in $x$ $\equiv (1/a_w) \partial a_w/\partial x$. |
grady | 1/m | (1104,) | Relative transverse gradient of undulator field in $y$ $\equiv (1/a_w) \partial a_w/\partial y$. |
ku | 1/m | (1104,) | |
kx | (1104,) | Roll-off parameter of the quadratic term of the undulator field in x. It is normalized with respect to $k_u^2$. | |
ky | (1104,) | Roll-off parameter of the quadratic term of the undulator field in y. | |
lattice_aw | (1104,) | The dimensionless rms undulator parameter. For planar undulator this value is smaller by a factor $1 / \sqrt{2}$ than its K-value, while for helical undulator rms and peak values are identical. | |
lattice_ax | m | (1104,) | Offset of the undulator module in $x$ in meter. |
lattice_ay | m | (1104,) | Offset of the undulator module in $y$ in meter. |
lattice_chic_angle | degree | (1104,) | |
lattice_chic_lb | m | (1104,) | Length of an individual dipole in meter. |
lattice_chic_ld | m | (1104,) | Drift between the outer and inner dipoles, projected onto the undulator axis. The actual path length is longer by the factor $1/\cos\theta$, where $\theta$ is the bending angle of an individual dipole. |
lattice_chic_lt | m | (1104,) | |
lattice_cx | rad | (1104,) | Kick angle in $x$ in units of $\gamma \beta_x$. |
lattice_cy | rad | (1104,) | Kick angle in $y$ in units of $\gamma \beta_y$. |
lattice_dz | m | (1104,) | Step length |
lattice_gradx | 1/m | (1104,) | Relative transverse gradient of undulator field in $x$ $\equiv (1/a_w) \partial a_w/\partial x$. |
lattice_grady | 1/m | (1104,) | Relative transverse gradient of undulator field in $y$ $\equiv (1/a_w) \partial a_w/\partial y$. |
lattice_ku | 1/m | (1104,) | |
lattice_kx | (1104,) | Roll-off parameter of the quadratic term of the undulator field in x. It is normalized with respect to $k_u^2$. | |
lattice_ky | (1104,) | Roll-off parameter of the quadratic term of the undulator field in y. | |
lattice_phaseshift | rad | (1104,) | Phase shift in radians. |
lattice_qf | 1/m^2 | (1104,) | Quadrupole focusing strength in $1/m^2$ |
lattice_qx | m | (1104,) | Quadrupole offset in $x$ in meters. |
lattice_qy | m | (1104,) | Quadrupole offset in $y$ in meters. |
lattice_slippage | (1104,) | Lattice slippage. | |
lattice_z | m | (1104,) | Step Z position in m. The same length and describes the lattice quantities from the position ``.z[i]`` to ``.z[i]+.dz[i]`` of the i-th integration step. |
lattice_zplot | m | (1105,) | For plotting the beam or field parameters along the undulator. |
lsc_field | eV/m | (1105, 1) | Longitudinal space charge [eV/m] |
meta_beamdumps_intstep | (0,) | ||
meta_fielddumps_intstep | (0,) | ||
peak_power | W | (1105,) | Peak power [W]. |
phase_farfield | rad | (1105, 1) | Far field phase [rad] |
phase_nearfield | rad | (1105, 1) | Near field phase [rad] |
phaseshift | rad | (1104,) | Phase shift in radians. |
power | W | (1105, 1) | Power [W] |
pxmax | rad | (1105, 1) | Particle horizontal maximum momentum [rad] |
pxmin | rad | (1105, 1) | Particle horizontal minimum momentum [rad] |
pxposition | rad | (1105, 1) | Particle horizontal position in momentum space [rad] |
pymax | rad | (1105, 1) | Particle vertical maximum momentum [rad] |
pymin | rad | (1105, 1) | Particle vertical minimum momentum [rad] |
pyposition | rad | (1105, 1) | Particle vertical position in momentum space [rad] |
qf | 1/m^2 | (1104,) | Quadrupole focusing strength in $1/m^2$ |
qx | m | (1104,) | Quadrupole offset in $x$ in meters. |
qy | m | (1104,) | Quadrupole offset in $y$ in meters. |
s | m | (1,) | Longitudinal position [m] |
slippage | (1104,) | Lattice slippage. | |
ssc_field | eV/m | (1105, 1) | Short-range space charge [eV/m] |
wakefield | eV/m | (1105, 1) | Wakefield, internally the energy loss. [eV/m] |
xmax | m | (1105, 1) | Particle horizontal maximum position [m] |
xmin | m | (1105, 1) | Particle horizontal minimum position [m] |
ymax | m | (1105, 1) | Particle vertical maximum position [m] |
ymin | m | (1105, 1) | Particle vertical minimum position [m] |
z | m | (1104,) | Step Z position in m. The same length and describes the lattice quantities from the position ``.z[i]`` to ``.z[i]+.dz[i]`` of the i-th integration step. |
zplot | m | (1105,) | For plotting the beam or field parameters along the undulator. |
InĀ [12]:
Copied!
output["beam_energy"]
output["beam_energy"]
Out[12]:
array([[5.80383409e+09], [5.80383409e+09], [5.80383409e+09], ..., [5.80353020e+09], [5.80353020e+09], [5.80353020e+09]])
Archive the results to an HDF5 fileĀ¶
InĀ [13]:
Copied!
G.archive("quickstart-results.h5")
G.archive("quickstart-results.h5")
InĀ [14]:
Copied!
restored = Genesis4.from_archive("quickstart-results.h5")
restored = Genesis4.from_archive("quickstart-results.h5")
InĀ [15]:
Copied!
restored.output.plot()
restored.output.plot()
InĀ [16]:
Copied!
G == restored
G == restored
Out[16]:
True