Visualization issue #1197
-
|
Dear All, I prepared an electron beam and studying its evolution in vacuum before coupling with other beamline elements. The electron has to travel 2 meters in vacuum. I used the following command to see the beam at 2 meter: # add beam diagnostics
monitor = elements.BeamMonitor("monitor", backend="h5")
sim.lattice.extend([ monitor,
elements.Drift(name="drift", ds=2.0),
monitor])
# run simulation
sim.track_particles()For visualization, I used the attached python file. I noticed that the figure always giving me the initial electron beam and not after 2 meters. Any suggestions will be highly appreciated. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
hi @sweber04, Thanks for your question and the script demonstrating it. When you use the same Looking at your script: beam_series = io.Series("diags/openPMD/monitor.h5", io.Access.read_only)
beam_steps = list(beam_series.iterations)if I print Thus, the next lines of your script visualize the first (initial output) and not the last one: # ...
step = 1
beam_at_step = beam_series.iterations[step].particles["beam"].to_df()If you want the final step, do: step_final = beam_steps[-1]
beam_final = beam_series.iterations[step_final].particles["beam"].to_df() |
Beta Was this translation helpful? Give feedback.
-
|
Hi @ax3l, Thank you. I will do it again and will come back to you if there is any other issue. Cheers, |
Beta Was this translation helpful? Give feedback.
hi @sweber04,
Thanks for your question and the script demonstrating it.
When you use the same
monitorname multiple times in a beamline, we will store the beam according to its "simulation step" in that monitor file. In other words, the line above will have a monitor output with two steps.Looking at your script:
if I print
beam_stepsI get:Thus, the next lines of your script visualize the first (initial output) and not the last one:
If you want the final step, do: