Skip to content
Snippets Groups Projects
Commit 4770618a authored by Vadim Gubaidulin's avatar Vadim Gubaidulin
Browse files

changed chromaticity computation in _compute_chro() of...

changed chromaticity computation in _compute_chro() of transverse_map_sector_generator(). Now it can compute arbitrary order of chromaticity from AT.
parent 454b0e7a
No related branches found
No related tags found
2 merge requests!280.8.0,!16Nonlinear chromaticity
...@@ -404,22 +404,15 @@ def transverse_map_sector_generator(ring, positions): ...@@ -404,22 +404,15 @@ def transverse_map_sector_generator(ring, positions):
else: else:
import at import at
def _compute_chro(ring, pos, dp=1e-4): def _compute_chro(ring, pos, dp=1e-4, order=4):
lat = deepcopy(ring.optics.lattice) lat = deepcopy(ring.optics.lattice)
lat.append(at.Marker("END")) lat.append(at.Marker("END"))
N = len(lat) fit, dpa, tune = at.physics.nonlinear.chromaticity(lat,
refpts = np.arange(N) method='linopt',
(*elem_neg_dp, ) = at.linopt2(lat, refpts=refpts, dp=-dp) dpm=0.02,
(*elem_pos_dp, ) = at.linopt2(lat, refpts=refpts, dp=dp) n_points=100,
order=order)
s = elem_neg_dp[2]["s_pos"] Chrox, Chroy = fit
mux0 = elem_neg_dp[2]["mu"][:, 0]
mux1 = elem_pos_dp[2]["mu"][:, 0]
muy0 = elem_neg_dp[2]["mu"][:, 1]
muy1 = elem_pos_dp[2]["mu"][:, 1]
Chrox = (mux1-mux0) / (2*dp) / 2 / np.pi
Chroy = (muy1-muy0) / (2*dp) / 2 / np.pi
chrox = np.interp(pos, s, Chrox) chrox = np.interp(pos, s, Chrox)
chroy = np.interp(pos, s, Chroy) chroy = np.interp(pos, s, Chroy)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment