Skip to content

Commit 31cb0a3

Browse files
committed
Added a test for off-momentum in 6D lattices
1 parent fb37386 commit 31cb0a3

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

atmat/attests/pytests.m

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@
77
"machine_data/spear3.m"];
88
end
99

10-
properties
11-
ring4
12-
ring6
13-
end
14-
1510
properties(TestParameter)
1611
dp = {0., -0.01, 0.01};
1712
dct = {0., -0.00005, 0.00005};
1813
lat = struct("hmba", "hmba","dba","dba","spear3","spear3");
1914
rad = struct("radoff","ring4","radon","ring6");
2015
lat2 = struct("hmba", "hmba","spear3","spear3");
2116
end
17+
18+
properties
19+
ring4
20+
ring6
21+
end
2222

2323
methods(TestClassSetup)
2424
function load_lattice(testCase)
2525
% Shared setup for the entire test class
2626
t=warning('off','AT:atradon:NOCavity');
27+
setoption('WarningDp6D',false);
2728
for fpath=testCase.mlist
2829
[~,fname,~]=fileparts(fpath);
2930
[testCase.ring4.(fname),testCase.ring6.(fname)]=mload(fpath);
@@ -35,8 +36,8 @@ function load_lattice(testCase)
3536
pr=atwritepy(mr,'keep_all',true);
3637
ring4.m=mr;
3738
ring4.p=pr;
38-
ring6.m=atradon(mr);
39-
ring6.p=pr.radiation_on(pyargs('copy',true));
39+
ring6.m=atenable_6d(mr);
40+
ring6.p=pr.enable_6d(pyargs('copy',true));
4041
end
4142
end
4243
end
@@ -114,6 +115,16 @@ function m66(testCase,lat2)
114115
pm66=double(pm66);
115116
testCase.verifyEqual(mm66,pm66,AbsTol=5.E-9);
116117
end
118+
119+
function offmom(testCase, dp)
120+
% Checks that off-momentum is correctly taken into account
121+
% for 6D lattices
122+
[ring1, elem1]=atlinopt6(testCase.ring4.hmba.m,'get_chrom', dp=dp);
123+
[ring2, elem2]=atlinopt6(testCase.ring6.hmba.m,'get_chrom', dp=dp);
124+
testCase.verifyEqual(ring1.tune, ring2.tune(1:2), AbsTol=1e-6);
125+
testCase.verifyEqual(ring1.chromaticity, ring2.chromaticity(1:2), AbsTol=5.e-5);
126+
testCase.verifyEqual(elem1.beta, elem2.beta, AbsTol=1.e-4)
127+
end
117128
end
118129

119130
methods(Test)

0 commit comments

Comments
 (0)