impactx icon indicating copy to clipboard operation
impactx copied to clipboard

Data Analysis: What is the `analysis_...py` file?

Open zhangli28 opened this issue 1 year ago • 3 comments

Hi,

I prepared an input-file for chicane using the input_kvdist_twiss.in format. The run was successful. Now, for data I use the analysis_chicane.py file but I got an error message:

Initial Beam:
  sigx=2.001725e-05 sigy=1.997410e-05 sigt=6.004582e-04
  emittance_x=1.013888e-08 emittance_y=1.007726e-08 emittance_t=1.804302e-07
  rtol=0.015556349186104048 (ignored: atol~=0.0)
Traceback (most recent call last):
  File "analysis_chicane.py", line 60, in <module>
    assert np.allclose(
AssertionError

the same error message was also appear when I use the file analysis_kvdist.py

However, I can make plots with plot_chicane.py file.

zhangli28 avatar Apr 27 '24 02:04 zhangli28

Hi @n01r @cemitch99 @ax3l ,

I want to make plots of initial electron beam current and longitudinal phase-space and the same for the final electron beam. How I can do that and all are in normal coordinates (x,y,s) (no "ct")

zhangli28 avatar Apr 27 '24 02:04 zhangli28

Hi @zhangli28, sorry about the confusion. The Python files called analysis_<example-name>.py are used by our automated regression tests, which are run by our CI. They ensure that when we make changes to the code our examples and tests still produce the same results. Hence, when you changed the input parameters of the example, the np.allclose from the analysis script failed because it is checking for hard-coded values.

But in your second message, it looks like you may have found the phase space plotting feature that was introduced here: https://github.com/ECP-WarpX/impactx/pull/469.

If you look in your diags directory of your successful run, you will notice files called ref_particle.*. These contain the data of the reference particle and one of the columns in there is s, as also mentioned in this issue: https://github.com/ECP-WarpX/impactx/issues/533. You can use this to offset the longitudinal phase space to absolute units.

n01r avatar Apr 29 '24 07:04 n01r

Hi @n01r ,

thank you. You are always very clear and supportive. I will check the ref_particle files and see if I can do what I am trying.

zhangli28 avatar Apr 29 '24 20:04 zhangli28