Replies: 27 comments 11 replies
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Dear @554sj4606, looking at your output you are using my code commissioning simulations. Could you share the mat file and the original MADX or MAD8 file? thank you |
Beta Was this translation helpful? Give feedback.
-
Dear @554sj4606, in any case looking at your code, the trajectory correction does not converge. Only 341/5628 BPMs see beam.
works? (I removed also the "particle = electron", as it is a future feature. |
Beta Was this translation helpful? Give feedback.
-
ring=at.load_lattice('FCCee_v23.mat',mat_key='ring')
at.Lattice(ring, energy = 45.6e9) Nothing to do with the problem itself, but the 2nd line is completely useless: you create a copy of |
Beta Was this translation helpful? Give feedback.
-
Now I understand: if you want to change the energy, either use: ring=at.load_lattice('FCCee_v23.mat', mat_key='ring', energy=45.6e9) or ring=at.load_lattice('FCCee_v23.mat',mat_key='ring')
ring.energy = 45.6e9 Maybe a wrong energy is a reason to miss RF voltage. |
Beta Was this translation helpful? Give feedback.
-
files.zip Many thanks for your inputs. I have tried using setting the energy inside the load_lattice function, but I sill see the error. |
Beta Was this translation helpful? Give feedback.
-
Hi @554sj4606 |
Beta Was this translation helpful? Give feedback.
-
Dear @554sj4606, in the commissioning simulatios code, if the input lattice is ok (see comments from @lfarv) then the issue is either with errors or correctors. From the output, the lattice is unstable, the beam threading is not succeeding.
|
Beta Was this translation helpful? Give feedback.
-
Dear @554sj4606, I tried your script, reducing the errors to 1e-6 in all elements. All works ok. In order to compute the orbit response I had to reduce the kick, or some orbits were not computed. |
Beta Was this translation helpful? Give feedback.
-
Dear @lfarv, is is possible that This is apparently what causes the problem in the commissioning simulations code of @554sj4606 . I will try reverting AT to an older release to understand when the change occurred. |
Beta Was this translation helpful? Give feedback.
-
here the small script to reproduce the error:
|
Beta Was this translation helpful? Give feedback.
-
I reverted to pyat-0.5.0 and the error message does not appear. only NAN |
Beta Was this translation helpful? Give feedback.
-
The error comes from |
Beta Was this translation helpful? Give feedback.
-
I ran you script, on the master branch, and I don't get errors:
And so on, 10 times. |
Beta Was this translation helpful? Give feedback.
-
For this test I did a new environment this morning and pip install accelerator-toolbox |
Beta Was this translation helpful? Give feedback.
-
Can you explain ? Either you get an error, or you get a result, it cannot be both…
So release 0.6.1. I'll try this one ! |
Beta Was this translation helpful? Give feedback.
-
I restored the main release. error is not reproduced anymore. I recreated the environment as this morning from zero (pip install --upgrade pip, pip install accelerator-toolbox, pip install matplotlib). Error is not reproduced anymore. So, I am unable to reproduce the error at the moment. in the bad case: find orbit would return NaN AND the RF voltage error , reported by Satya. But for now, I may not reproduce it. So it is fixed by pure conversation. |
Beta Was this translation helpful? Give feedback.
-
Here the list of actions that makes the script of @554sj4606 work:
for orbit correction to work, dcorL in /commissioningsimulations/correction/ClosedOrbit.py has to be changed to 1e-7 (line 459) I will push this change to commissioning simulations (it is unrelated to this issue). |
Beta Was this translation helpful? Give feedback.
-
We should talk more !
Impossible. If there is an exception, find_orbit does not return at all. |
Beta Was this translation helpful? Give feedback.
-
Dear @lfarv and @554sj4606, I think the problem is in So I will modify commissioning simulations code to protect from this issue, in order to let Satya continue his work. |
Beta Was this translation helpful? Give feedback.
-
Here the running script and the full reinstallation/update sequence:
please @554sj4606 let me know if it works |
Beta Was this translation helpful? Give feedback.
-
Dear all, I appreciate all your efforts. I will try what @simoneliuzzo suggested and let you know if it works |
Beta Was this translation helpful? Give feedback.
-
hello all, I have also tried running @simoneliuzzo script on my side, I have python 3.11 and numpy 1.24.2 and the pyAT master branch.
I have added the following lines in orbit.py:
Which seem to solve this issue. However, I could not produce any error relating to RF voltage. |
Beta Was this translation helpful? Give feedback.
-
Following @swhite2401's test, I have a suspicion: the failing tracking over 1 turn could break the computation of the energy loss itself. If the energy loss comes out as NaN (to be checked), the test I think that Then in
In any case, we need to improve the error message so that the user understands what happens ("missing RF voltage" is misleading). But the error itself is justified: there is nothing you can do if tracking over 1 turn fails, and for the caller, catching the error is as easy as checking for nans. |
Beta Was this translation helpful? Give feedback.
-
@lfarv , the is a protection on the energy loss calculation, if tracking one turn fails then it is performed element by element so in principle this cannot fail... but it is true that it is the only thing I can think of that would produce this error (which I could not reproduce by the way...) .... more tests needed. Concerning the failed closed orbit calculation I have no strong opinion on that but for sure the error message needs to be improved. |
Beta Was this translation helpful? Give feedback.
-
@lfarv, throwing an exception instead of returning NaNs would break backward compatibility and require to modify all the code that depend on pyAT, since closed orbit is rather central we should be very very careful if modifying its behavior. What I would propose is to fix the bug maintaining backward compatiblity now and then propose the "cleaner" solution for the next major release. Could we use this |
Beta Was this translation helpful? Give feedback.
-
@swhite2401 : I fully agree with your comment, but what I proposed did not change anything: presently we have the error "missing RF voltage". I just suggest to replace that with a better message, if needed. And optionally to catch the error and try to go on anyway with orbit computation. However, considering your last remark on element by element tracking computation, the possibility of having NaN in the energy loss looks very unlikely, but not completely excluded (like r_in[0] correct, but r_in[4] == NaN). On the other hand, If the reported error is right, the reasons to get what @554sj4606 and @simoneliuzzo reported is that:
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I hope this email finds you well. I am Satya, a PhD student at CERN working on FCC-ee optics tuning studies with pyAT. I am writing to seek your advice regarding an issue I am encountering with beam threading. Specifically, I applied larger alignment errors of 100 µm on arc magnets and 70 µm on IR magnets, then attempted to run the optics correction algorithm starting with beam threading. However, the algorithm fails at the beam threading step, reporting that the "RF voltage is not enough" (please refer to the attached error). Despite setting the RF voltage correctly, the error persists. Below, I have detailed how the RF voltage was configured. I would greatly appreciate any guidance or suggestions to resolve this issue.
ring=at.load_lattice('FCCee_v23.mat',mat_key='ring')
at.Lattice(ring,energy = 45.6e9,particle='electron')
ring.enable_6d()
ring.harmonic_number = 121200
ring.set_cavity(Voltage=79e6)
ring.set_rf_frequency()
ring.set_cavity_phase()
ring.tapering()
Error:
iteration # 8/100 with 250/5628 BPMs and 251/1876 steerers
Hor. traj. | std: 287 microm | (min, max) (-1.68e+03, 2e+03)
Ver. traj. | std: 203 microm | (min, max) (-1.1e+03, 1.32e+03)
Hor. cor. | std: 0.918 microrad | (min, max) (-5.81, 5.84)
Ver. cor. | std: 0.995 microrad | (min, max) (-9.96, 6.56)
orbit is found? False
iteration # 9/100 with 254/5628 BPMs and 255/1876 steerers
Hor. traj. | std: 113 microm | (min, max) (-1.71e+03, 13.8)
Ver. traj. | std: 45.3 microm | (min, max) (-717, 88.3)
Hor. cor. | std: 0.92 microrad | (min, max) (-5.81, 5.83)
Ver. cor. | std: 0.998 microrad | (min, max) (-9.96, 6.55)
orbit is found? False
iteration # 10/100 with 325/5628 BPMs and 326/1876 steerers
Hor. traj. | std: 291 microm | (min, max) (-1.55e+03, 1.72e+03)
Ver. traj. | std: 367 microm | (min, max) (-1.9e+03, 1.96e+03)
Hor. cor. | std: 1.02 microrad | (min, max) (-5.81, 5.83)
Ver. cor. | std: 1.1 microrad | (min, max) (-9.96, 6.55)
orbit is found? False
iteration # 11/100 with 341/5628 BPMs and 342/1876 steerers
Hor. traj. | std: 101 microm | (min, max) (-866, 881)
Ver. traj. | std: 143 microm | (min, max) (-1.51e+03, 1.64e+03)
Hor. cor. | std: 1.05 microrad | (min, max) (-5.81, 5.83)
Ver. cor. | std: 1.12 microrad | (min, max) (-9.96, 6.55)
Not enough RF voltage: unstable ring
correction trajectory failed
lattice is unstable after correction step: trajectory
Beta Was this translation helpful? Give feedback.
All reactions