lnls-fac / pyaccel

Python module for beam dynamics tracking and optics calculations
MIT License
7 stars 5 forks source link

Add calculation of first order resonance driving terms #145

Closed fernandohds564 closed 2 months ago

fernandohds564 commented 2 months ago

For now, only normal sextupolar driving terms are being computed.

Running the following code:

import numpy as np
import matplotlib.pyplot as mplt
import pyaccel as pa
from pymodels import si

mod = si.create_accelerator()
rdts = pa.optics.FirstOrderDrivingTerms(mod, num_segments=10, energy_offset=0.0)
fig, axs = rdts.plot_rdt_along_ring(geometric=True, symmetry=5)
fig.show()
fig, axs = rdts.plot_rdt_along_ring(geometric=False, symmetry=5)
fig.show()

fig, ax = rdts.plot_one_turn_rdts(geometric=True)
fig.show()
fig, ax = rdts.plot_one_turn_rdts(geometric=False)
fig.show()

print(-rdts.h11001[-1] / np.pi, -rdts.h00111[-1] / np.pi)
print(pa.optics.miscellaneous.get_chromaticities(mod))

will result in:

(2.5399940500906566-0j) (2.50703643220055-0j)
(2.5399182477375826, 2.521281232903405)

image image

image image