Skip to content

New fastring#1082

Open
swhite2401 wants to merge 30 commits into
masterfrom
new_fastring
Open

New fastring#1082
swhite2401 wants to merge 30 commits into
masterfrom
new_fastring

Conversation

@swhite2401

Copy link
Copy Markdown
Contributor

This PR proposes a new implementation for the fast ring allowing to switch radiations on and off with standard lattice function.
Only one lattice object is then produced.
It is also possible to model higher order chromaticity terms with manual input. The automated generation considers only linear terms. This is safer since fit parameters have to be adapted depending on the order the the user wants to consider.

@swhite2401 swhite2401 added enhancement WIP work in progress Python For python AT code labels May 19, 2026
@swhite2401

Copy link
Copy Markdown
Contributor Author

@lfarv, @lcarver, @oscarxblanco this is still WIP and more testing is needed but I believe all the functionalities requested are now implemented. Please take a first look and let me know if you see something that needs to be modified/improved.

@swhite2401

Copy link
Copy Markdown
Contributor Author

For the moment the new function is in physics/new_fastring.py to allow for easy comparison and testing. Once validated I will move everything to fastring.py and replace the old implementation.

@swhite2401 swhite2401 removed the WIP work in progress label Jun 5, 2026
@swhite2401

Copy link
Copy Markdown
Contributor Author

@lcarver still waiting for your review....

@lcarver

lcarver commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
import at
from at.physics.new_fastring import *

ring = at.load_mat('/machfs/carver/Repo/EBSlattices/AT/S28F.mat', mat_key = 'LOW_EMIT_RING_INJ')
ring.enable_6d()
print(ring.radiation, ring.energy_loss)


fring = fast_ring_new(ring)
print(fring.radiation, fring.energy_loss)

fring.enable_6d()
print(fring.radiation, fring.energy_loss)

output:

True 2532505.842292285
True 0.0
True 0.0

if I try:
at.get_energy_loss(fring, method=at.ELossMethod.TRACKING)
I get:
2375654.915012846

@lcarver

lcarver commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hello, the problem is here:


    @check_radiation(True)
    def tracking(ring):
        """Losses from tracking"""
        energy = ring.energy
        particle = ring.particle
        delta = 0.0
        try:
            o6, *_ = ring.find_orbit(method=ELossMethod.INTEGRAL)
            o6l, *_ = ring.disable_6d(RFCavity, copy=True).track(o6)
            delta = np.squeeze(o6l)[4] - o6[4]
        except:
            for e in ring:
                if e.PassMethod == 'SimpleRadiationRadPass':
                    delta -= e.U0 / energy #Needed to prevent mixing with rad. damping
                elif e.PassMethod.endswith('RadPass'):
                    ot = e.track(np.zeros(6), energy=energy, particle=particle)
                    delta += ot[4]
        return -delta*energy

For the fast ring, the code does not raise an error when computing find_orbit with the INTEGRAL method, and it does not exclude the Quantum Diffusion, so it never reaches the tracking part in the second section which does exclude it.

@swhite2401

Copy link
Copy Markdown
Contributor Author

Variable elements are now excluded and a warning is issued when the closed orbit calculation fails and energy loss calculation falls back to the element-by-element method that ignores closed orbit effects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Python For python AT code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants