Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ring phase advances in computeRDT.m #652

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

wei0852
Copy link
Contributor

@wei0852 wei0852 commented Aug 30, 2023

Mux and Muy in computeRDT.m were actually the phases at the entrance of last element.
When the length of the last element is not zero, the computation of ring phase advances is wrong.
As a consequence, tune shifts and RDTs that are not calculated from the 1st element are wrong.

For example:

ring1 = esrf();
ring2 = [ring1(8:end);ring1(1:7)];

rdt1 = computeRDT(ring1,8) % From 2nd BPM

rdt2 = computeRDT(ring2,1) % also From 2nd BPM

rdt1 =
h11001: 25.1834
h00111: 45.1136
h20001: 0.0755 + 0.1779i
h00201: 0.0422 + 0.1429i
h10002: 0.0500 - 0.3601i
h10010: 0
h10100: 0
h21000: -68.6699 - 0.1131i
h30000: 7.7692 +16.3715i
h10110: 28.8522 -10.3888i
h10020: 2.9353 + 8.9459i
h10200: 1.3818 + 6.7089i
h22000: 3.7055e+03 - 3.0468e-11i
h11110: 9.7232e+03 + 2.3368e-10i
h00220: 4.7966e+03 - 4.0785e-11i
h31000: -5.8717e+02 - 5.2378e+03i
h40000: 3.2593e+03 - 1.0963e+03i
h20110: -8.0882e+02 + 1.7939e+03i
h11200: 1.4889e+03 - 3.6767e+02i
h20020: -4.6061e+02 + 1.1368e+03i
h20200: -2.9437e+03 + 2.5429e+03i
h00310: 5.5242e+02 + 1.3216e+02i
h00400: -37.7555 +85.8562i
dnux_dJx: -2.5579e+03
dnux_dJy: 7.4135e+03
dnuy_dJy: 6.5738e+03

rdt2 =
h11001: 25.1834
h00111: 45.1136
h20001: 0.0512 + 0.1448i
h00201: 0.3746 - 0.0564i
h10002: 0.0526 - 0.3543i
h10010: 0
h10100: 0
h21000: -69.7618 - 2.3315i
h30000: 5.3504 +15.8847i
h10110: 29.3188 - 9.4408i
h10020: 11.2645 +12.5856i
h10200: 3.7548 - 2.8225i
h22000: 3.0545e+03 + 3.1832e-11i
h11110: 1.0434e+04 - 9.2371e-11i
h00220: 4.9452e+03 - 2.1345e-11i
h31000: -4.2072e+02 - 4.4518e+03i
h40000: 3.0140e+03 - 8.2842e+02i
h20110: -2.7607e+02 + 1.8148e+03i
h11200: 1.2372e+03 + 8.8460e+02i
h20020: 9.8502e+01 + 5.7840e+02i
h20200: -2.9319e+03 + 1.9509e+03i
h00310: 5.9974e+02 + 8.7589e+01i
h00400: 63.4596 -21.5369i
dnux_dJx: -1.7657e+03
dnux_dJy: 7.1637e+03
dnuy_dJy: 6.2307e+03

fix bug when the length of last element is not 0.
@lfarv
Copy link
Contributor

lfarv commented Sep 4, 2023

@wei0852 : That looks correct for me. I do not know why the tests don't run, but it's not critical.

@simoneliuzzo: can you confirm that the fix is correct?

@lfarv lfarv added Matlab For Matlab/Octave AT code bug fix labels Sep 6, 2023
@lfarv
Copy link
Contributor

lfarv commented Sep 6, 2023

The tests are now running (no explanation). If there is no objection, I'll merge tomorrow.

@simoneliuzzo
Copy link
Contributor

looks ok also for me

Copy link
Contributor

@lfarv lfarv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@lfarv
Copy link
Contributor

lfarv commented Sep 7, 2023

OK for merging, thanks @wei0852

@lfarv lfarv merged commit e84bb39 into atcollab:master Sep 7, 2023
14 checks passed
@wei0852 wei0852 deleted the correct_computeRDT branch September 7, 2023 10:15
lnadolski added a commit that referenced this pull request Oct 25, 2023
# By Laurent Farvacque (14) and others
# Via GitHub
* master: (28 commits)
  Add passive beamloading cavity (#586)
  Create BndStrMPoleSymplectic4RadPass (#665)
  Documentation fixes (#669)
  Update of the build process (#659)
  New Matlab function atsimplering (#657)
  Collective bugfix (#664)
  Correct the attribute name of solenoids in Matlab (#663)
  Error parsing args for twiss_in and r_4d (#662)
  Fix atmaincavities (#656)
  Fix attribute names in Simple Ring (#655)
  Remove collective passes from internal lattice_pass (#650)
  The DPStep keyword in linopt6 raises an error for 4D lattices (#651)
  Bug fix in atdisable_6d: keep the Energy field in cavities. (#654)
  fix: ring phase advances in computeRDT.m (#652)
  Correct the axis definition in plot_sigma (#648)
  Don't automatically cache the location of RF cavities (#640)
  Simple ring model (#643)
  Correct Dipole tapering (#623)
  Chromatic functions extended (#644)
  Repair the Matlab tests (#645)
  ...

# Conflicts:
#	atmat/Contents.m
#	atmat/atphysics/Radiation/atdisable_6d.m
#	atmat/atphysics/Radiation/atenable_6d.m
#	atmat/lattice/at2str.m
#	atmat/pubtools/create_elems/atidtable_dat.m
#	pyat/at/lattice/elements.py
#	pyat/at/lattice/lattice_object.py
#	pyat/at/physics/matrix.py
#	pyat/at/physics/radiation.py
#	pyat/examples/CollectiveEffects/RobinsonInstability.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Matlab For Matlab/Octave AT code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants