Skip to content

Commit 92a2f73

Browse files
authored
Compute RDTs (#821)
* fix matlab bug in avemu * avoid import twice numpy + bugfix * add rdt module to pyat * add quadrupole rdts * docstring + blacked * 2nd order tuneshift * 2nd order geometric * blacked * remove atlinopt from matlab avedata * reformat formulas * reformat formulas * parallelized calculation * black * fix phase * fix h00310 * initialize periodicfactor with dtype=complex * compute tune for nperiods * compute periodicfactor outside loop * improve comments and help * fix sign and add refs * switch to import numpy as np * perdiodicity in docstring * correct coupling rdts * sign of coupling rdt * Remove dataclass and separate second order * improve docs * remove np.complex * docstring * restore matlab avemu * add tests + bugfix * fix docstring
1 parent 8aaae3e commit 92a2f73

File tree

5 files changed

+1285
-262
lines changed

5 files changed

+1285
-262
lines changed

atmat/atphysics/atavedata.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
needed=refs | [false;long]; %lr
2727
initial=[long(needed(1:end-1));false]; %needed
2828
final=[false;initial(1:end-1)]; %needed
29-
[lind,nu,xsi]=atlinopt(ring,dpp,needed,varargin{:}); %needed
29+
setoption('WarningDp6D',false)
30+
[ringdata, lind]=atlinopt6(ring,needed,'dp',dpp,'get_chrom',varargin{:}); %needed
31+
setoption('WarningDp6D',true)
32+
nu = ringdata.tune;
33+
xsi = ringdata.chromaticity;
3034

3135
lindata=lind(refs(needed)); %refpts
3236
avebeta=cat(1,lindata.beta); %refpts
@@ -41,7 +45,7 @@
4145

4246
beta0=avebeta(lg,:); %long
4347
alpha0=cat(1,lin0.alpha); %long
44-
mu0=avemu(lg,:);
48+
mu0=avemu(lg,:); %long
4549
disp0=avedisp(lg,:); %long
4650

4751
mu1=cat(1,lin1.mu); %long

pyat/at/physics/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
from .nonlinear import *
1919
from .fastring import *
2020
from .frequency_maps import fmap_parallel_track
21+
from .rdt import *
2122
from .magnet_tools import *

pyat/at/physics/linear.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,10 @@
102102

103103

104104
_IDX_DTYPE = [("idx", np.uint32)]
105-
106-
107105
warnings.filterwarnings("always", category=AtWarning, module=__name__)
108106

109107

108+
110109
def _twiss22(t12, alpha0, beta0):
111110
"""Propagate Twiss parameters"""
112111
bbb = t12[:, 0, 1]
@@ -1372,7 +1371,7 @@ def displong(disp0, ir, k2, lg):
13721371
longi_refpts = np.append(longelem, [False])
13731372
longf_refpts = np.roll(longi_refpts, 1)
13741373
all_refs = boolrefs | longf_refpts
1375-
_, bd, d_all = linopt4(ring, refpts=all_refs, dp=dp, get_chrom=True, **kwargs)
1374+
_, bd, d_all = get_optics(ring, refpts=all_refs, dp=dp, get_chrom=True, **kwargs)
13761375
lindata = d_all[boolrefs[all_refs]] # Optics at entrance of selected elements
13771376

13781377
avebeta = lindata.beta.copy()

0 commit comments

Comments
 (0)