Skip to content

Commit 1d09916

Browse files
committed
Adapt example
1 parent eb7cfe1 commit 1d09916

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

examples/multiline_matching/000_multiline_match.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@
5252
assert np.isclose(tw1.lhcb2.qy, 60.325, atol=1e-4, rtol=0)
5353

5454
# Match bumps in the two likes
55+
tw0 = collider.twiss(lines=['lhcb1', 'lhcb2'])
5556
collider.match(
5657
lines=['lhcb1', 'lhcb2'],
5758
ele_start=['mq.33l8.b1', 'mq.22l8.b2'],
5859
ele_stop=['mq.23l8.b1', 'mq.32l8.b2'],
59-
twiss_init='preserve',
60+
twiss_init=tw0, ele_init=xt.START,
6061
vary=[
6162
xt.VaryList([
6263
'acbv30.l8b1', 'acbv28.l8b1', 'acbv26.l8b1', 'acbv24.l8b1'],
@@ -71,10 +72,10 @@
7172
xt.Target('y', at='mb.b27l8.b2', line='lhcb2', value=2e-3, tol=1e-4, scale=1),
7273
xt.Target('py', at='mb.b27l8.b2', line='lhcb2', value=0, tol=1e-6, scale=1000),
7374
# I want the bump to be closed
74-
xt.TargetList(['y'], at='mq.23l8.b1', line='lhcb1', value='preserve', tol=1e-6, scale=1),
75-
xt.TargetList(['py'], at='mq.23l8.b1', line='lhcb1', value='preserve', tol=1e-7, scale=1000),
76-
xt.TargetList(['y'], at='mq.32l8.b2', line='lhcb2', value='preserve', tol=1e-6, scale=1),
77-
xt.Target('py', at='mq.32l8.b2', line='lhcb2', value='preserve', tol=1e-10, scale=1000),
75+
xt.TargetList(['y'], at='mq.23l8.b1', line='lhcb1', value=tw0, tol=1e-6, scale=1),
76+
xt.TargetList(['py'], at='mq.23l8.b1', line='lhcb1', value=tw0, tol=1e-7, scale=1000),
77+
xt.TargetList(['y'], at='mq.32l8.b2', line='lhcb2', value=tw0, tol=1e-6, scale=1),
78+
xt.Target('py', at='mq.32l8.b2', line='lhcb2', value=tw0, tol=1e-10, scale=1000),
7879
]
7980
)
8081
tw_bump = collider.twiss(lines=['lhcb1', 'lhcb2'])

xmask/lhc/leveling.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def luminosity_leveling(collider, config_lumi_leveling, config_beambeam):
4646
else:
4747
raise ValueError('Either `luminosity` or `separation_in_sigmas` must be specified')
4848

49+
tw0 = collider.twiss()
4950
if config_this_ip['impose_separation_orthogonal_to_crossing']:
5051
targets.append(
5152
xt.TargetSeparationOrthogonalToCrossing(ip_name='ip8'))
@@ -62,10 +63,10 @@ def luminosity_leveling(collider, config_lumi_leveling, config_beambeam):
6263
for line_name in ['lhcb1', 'lhcb2']:
6364
targets += [
6465
# Preserve crossing angle
65-
xt.TargetList(['px', 'py'], at=ip_name, line=line_name, value='preserve', tol=1e-7, scale=1e3),
66+
xt.TargetList(['px', 'py'], at=ip_name, line=line_name, value=tw0, tol=1e-7, scale=1e3),
6667
# Close the bumps
67-
xt.TargetList(['x', 'y'], at=bump_range[line_name][-1], line=line_name, value='preserve', tol=1e-5, scale=1),
68-
xt.TargetList(['px', 'py'], at=bump_range[line_name][-1], line=line_name, value='preserve', tol=1e-5, scale=1e3),
68+
xt.TargetList(['x', 'y'], at=bump_range[line_name][-1], line=line_name, value=tw0, tol=1e-5, scale=1),
69+
xt.TargetList(['px', 'py'], at=bump_range[line_name][-1], line=line_name, value=tw0, tol=1e-5, scale=1e3),
6970
]
7071

7172
vary.append(xt.VaryList(config_this_ip['corrector_knob_names'], step=1e-7))
@@ -75,7 +76,7 @@ def luminosity_leveling(collider, config_lumi_leveling, config_beambeam):
7576
lines=['lhcb1', 'lhcb2'],
7677
ele_start=[bump_range['lhcb1'][0], bump_range['lhcb2'][0]],
7778
ele_stop=[bump_range['lhcb1'][-1], bump_range['lhcb2'][-1]],
78-
twiss_init='preserve',
79+
twiss_init=tw0, ele_init=xt.START,
7980
targets=targets,
8081
vary=vary,
8182
solve=False,

0 commit comments

Comments
 (0)