Open koesterf opened 4 months ago
Hi @koesterf,
Thanks for your question!
You want to use the reduced_beam_characteristics.0.0
file, which has a line entry per simulation step. The _final
named ones only contain the last step.
The columns contain the bunch parameters you are interested in and are in the text file as follows: https://impactx.readthedocs.io/en/latest/dataanalysis/dataanalysis.html#reduced-beam-characteristics
You an read this file with numpy or pandas or Excel or any other preferred CSV reader. Columns are space separated, the first line is the header (as in the documentation link).
Alternatively, in ImpactX 24.05+, this data will also be part of the openPMD data in the BeamMonitor
element (#584).
Hi @ax3l, thanks for explaining how to plot. It works exactly as I was looking for.
If you could suggest me one more thing it will be great: how to plot longitudinal as well as transverse phase-space.
I mean longitudinal (s-pt) and transverse (x-px and y-py). Because in header I don't see these values, but px_mean, px_min, px_max etc.
header_names Index(['step', 's', 'ref_beta_gamma', 'x_mean', 'x_min', 'x_max', 'y_mean',
'y_min', 'y_max', 't_mean', 't_min', 't_max', 'sig_x', 'sig_y', 'sig_t',
'px_mean', 'px_min', 'px_max', 'py_mean', 'py_min', 'py_max', 'pt_mean',
'pt_min', 'pt_max', 'sig_px', 'sig_py', 'sig_pt', 'emittance_x',
'emittance_y', 'emittance_t', 'alpha_x', 'alpha_y', 'alpha_t', 'beta_x',
'beta_y', 'beta_t', 'charge_C', 'Unnamed: 37'],
dtype='object')
Thanks a lot.
Hi @ax3l , using the plot chicane file I can make the phase-space evolution. See the attached figure. But how to increase the frequency of such output ? For example, I want to see the phase-space plot after every magnet of the chicane what should I do ?
could you also confirm that fist row is the longitudinal phase space ? If yes, could you please tell me how to make the longitudinal phase-space with respect to s
coordinate ?
Hi @ax3l @cemitch99, just a friendly reminder of my above request.
Cheers, Frank
Hi @koesterf,
Sorry for the delay, I had a couple of business trips and was swamped in backlog and an upcoming review.
If you could suggest me one more thing it will be great: how to plot longitudinal as well as transverse phase-space.
Perfect, you already found it. Above, I explained how to find collective beam properties. For phase space plots, you want to create output for individual particles, for which we have the BeamMonitor element, and then histogram the properties you like to correlate in post-processing, as you did. https://impactx.readthedocs.io/en/latest/dataanalysis/dataanalysis.html
could you also confirm that fist row is the longitudinal phase space ? If yes, could you please tell me how to make the longitudinal phase-space with respect to s coordinate ?
Looks on a high level correct. But please post your post-processing script so we can see what you did.
Usually, you make a longitudinal phase space as t-pt
for a fixed s
(the default independent variable in ImpactX). See our: Coordinates and Units.
But how to increase the frequency of such output ? For example, I want to see the phase-space plot after every magnet of the chicane what should I do ?
You can increase the frequency, e.g., between every element, by placing the BeamMonitor
element between each element of your lattice. Example: FODO
# ...
# add beam diagnostics
monitor = elements.BeamMonitor("monitor", backend="h5")
# design the accelerator lattice)
ns = 25 # number of slices per ds in the element
fodo = [
monitor,
elements.Drift(ds=0.25, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=1.0, nslice=ns),
monitor,
elements.Drift(ds=0.5, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=-1.0, nslice=ns),
monitor,
elements.Drift(ds=0.25, nslice=ns),
monitor,
]
# assign a fodo segment
sim.lattice.extend(fodo)
# ...
Hi,
I run the simulation successfully. Now, I want to make plots of evolution of
(1) Twiss: beta_x and beta_y function with the propagation length. (2) emittance_x and emittance_y with the propagation length. (3) bunch length evolution with the propagation length.
There are 4 files in the diags directory (i) reduced_beam_characteristics.0.0, (ii) ref_particle.0.0 (iii) reduced_beam_characteristics_final.0.0 (iv) ref_particle_final.0.0
Which files I should use to make plots.
Thanks. Frank