Skip to content

Commit e28ab4c

Browse files
authored
Merge pull request #308 from jgray-19/ng_vs_ng
Improve ng vs ng tests
2 parents e893fee + cd21389 commit e28ab4c

File tree

1 file changed

+57
-40
lines changed

1 file changed

+57
-40
lines changed

tests/tests/test-ng-maps/test-ng-maps.mad

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ local ref_cfg = object "ref" {
5353
}
5454

5555

56+
local default_plot_cfg = {
57+
series = {
58+
"'${test_type}' == 'edir'",
59+
"'${test_type}' == 'chg'",
60+
"'${test_type}' == 'backtrack'",
61+
},
62+
legend = {
63+
y1 = "Reverse edir",
64+
y2 = "Reverse charge",
65+
y3 = "Backtrack",
66+
},
67+
}
68+
5669
-- The actual test functions --------------------------------------------------o
5770
local function testQUAD() -- Test the body (~2 min)
5871
local cfg = ref_cfg "quad" {
@@ -70,22 +83,10 @@ local function testQUAD() -- Test the body (~2 min)
7083
alist = tblcat(ref_cfg.alist, {"k1", "k1s"}),
7184

7285
plot_info = {
73-
title = "Quadrupole NG v NG Maps",
74-
series = {
75-
"'${test_type}' == 'edir'",
76-
"'${test_type}' == 'chg'",
77-
"'${test_type}' == 'backtrack'",
78-
"'${test_type}' == 'rotate_1'",
79-
"'${test_type}' == 'rotate_2'",
80-
},
81-
legend = {
82-
y1 = "Reverse edir",
83-
y2 = "Reverse charge",
84-
y3 = "Backtrack",
85-
y4 = "Rotate by pi/4",
86-
y5 = "Rotate by -pi/4",
87-
},
86+
title = "Quadrupole NG v NG Maps",
8887
filename = "quad-ngvng.png",
88+
series = default_plot_cfg.series,
89+
legend = default_plot_cfg.legend,
8990
}
9091
}
9192
local equiv = object "quad" {
@@ -117,18 +118,10 @@ local function testSBEND() -- Test the body (~2 min)
117118
alist = tblcat(ref_cfg.alist, {"angle_div"}),
118119

119120
plot_info = {
120-
title = "SBend NG v NG Maps",
121-
series = {
122-
"'${test_type}' == 'edir'",
123-
"'${test_type}' == 'chg'",
124-
"'${test_type}' == 'backtrack'",
125-
},
126-
legend = {
127-
y1 = "Reverse edir",
128-
y2 = "Reverse charge",
129-
y3 = "Backtrack",
130-
},
121+
title = "SBend NG v NG Maps",
131122
filename = "sbend-ngvng.png",
123+
series = default_plot_cfg.series,
124+
legend = default_plot_cfg.legend,
132125
}
133126
}
134127
run_test(cfg, {alist = {}})
@@ -138,7 +131,8 @@ local function testRBEND() -- Test the body (~2 min)
138131
local cfg = ref_cfg "rbend" {
139132
elm = [[rbend 'rbend' {
140133
at=0.75, l=1.5, k0=${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0,
141-
e1 = ${edir}*${e1}*math.pi/${angle_div}*1.5, e2 = ${edir}*${e2}*math.pi/${angle_div}*1.5
134+
e1 = ${tdir}*${e1}*math.pi/${angle_div}*1.5, e2 = ${tdir}*${e2}*math.pi/${angle_div}*1.5,
135+
true_rbend = ${true_rbend},
142136
}]],
143137
model = {1, 2},
144138
method = 2..6..2,
@@ -148,23 +142,45 @@ local function testRBEND() -- Test the body (~2 min)
148142
tol = 2000,
149143

150144
angle_div = {50, 100, 200, 500, 1000},
145+
true_rbend = {false, true},
151146
e1 = {-0.15, 0, 0.2},
152147
e2 = {-0.2, 0, 0.15},
153-
alist = tblcat(ref_cfg.alist, {"angle_div", "e1", "e2"}),
148+
alist = tblcat(ref_cfg.alist, {"true_rbend", "angle_div", "e1", "e2"}),
154149

155150
plot_info = {
156-
title = "RBend NG v NG Maps",
157-
series = {
158-
"'${test_type}' == 'edir'",
159-
"'${test_type}' == 'chg'",
160-
"'${test_type}' == 'backtrack'",
161-
},
162-
legend = {
163-
y1 = "Reverse edir",
164-
y2 = "Reverse charge",
165-
y3 = "Backtrack",
166-
},
151+
title = "RBend NG v NG Maps",
167152
filename = "rbend-ngvng.png",
153+
series = default_plot_cfg.series,
154+
legend = default_plot_cfg.legend,
155+
} }
156+
run_test(cfg, {alist = {}})
157+
end
158+
159+
local function testRBENDPARALLEL()
160+
local cfg = ref_cfg "rbend_parallel" {
161+
elm = [[rbend 'rbend' { true_rbend = true,
162+
at=0.75, l=1.5, k0=${bdir}*math.pi/${angle_div}, angle=${tdir}*math.pi/${angle_div}*1.5, fringe=0,
163+
e1 = ${e1} and ${tdir}*${e1}*math.pi/${angle_div}*1.5, e2 = ${e2} and ${tdir}*${e2}*math.pi/${angle_div}*1.5
164+
}]],
165+
166+
model = {1, 2},
167+
method = 2..6..2,
168+
nslice = 1..3,
169+
energy = {1, 6500}, -- {1, 450, 6500}
170+
171+
tol = 2000,
172+
173+
angle_div = {50, 100, 200, 500, 1000},
174+
patch_first = {false, true},
175+
e1 = \s -> s.cur_cfg.patch_first and {false} or {-0.15, 0, 0.2},
176+
e2 = \s -> s.cur_cfg.patch_first and {-0.2, 0, 0.15} or {false},
177+
alist = tblcat(ref_cfg.alist, {"patch_first", "angle_div", "e1", "e2"}),
178+
179+
plot_info = {
180+
title = "True Parallel RBend NG v NG Maps",
181+
filename = "true-parallel-rbend-ngvng.png",
182+
series = default_plot_cfg.series,
183+
legend = default_plot_cfg.legend,
168184
}
169185
}
170186
run_test(cfg, {alist = {}})
@@ -213,4 +229,5 @@ end
213229
testQUAD()
214230
testSBEND()
215231
testRBEND()
216-
-- testRFMULTIPOLE()
232+
testRBENDPARALLEL()
233+
-- testRFMULTIPOLE()

0 commit comments

Comments
 (0)