Skip to content

Commit dca2933

Browse files
committed
small documentation adjustements
1 parent eb24b5c commit dca2933

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

examples/demo_lhc_rigid_waist_shift.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
99
This example shows how to use the `~.lhc.apply_lhc_rigidity_waist_shift_knob`
1010
function to force a waist shift at a given IP and break the symmetry of the
11-
:math:`\\beta`-functions in the Interaction Region.
11+
:math:`\\beta`-functions in the Interaction Region. This is done by
12+
over-powering one triplet and under-powering the other, by the same powering
13+
delta.
1214
1315
We will do a comparison of the interaction region situation before and after
14-
applying a rigid waist shift.
16+
applying a rigid waist shift, and look in more details at the waist shift
17+
itself.
1518
1619
.. note::
1720
This is very specific to the LHC machine and the implementation would not
@@ -32,6 +35,8 @@
3235
plt.rcParams.update(defaults._SPHINX_GALLERY_PARAMS) # for readability of this tutorial
3336

3437
###############################################################################
38+
# Showcasing the Waist Shift
39+
# --------------------------
3540
# Let's start by setting up the LHC in ``MAD-X``, in this case at top energy:
3641

3742
madx = Madx(stdout=False)
@@ -89,7 +94,8 @@
8994
#
9095
# .. hint::
9196
# A waist shift knob setting of 1 will result in a 0.5% change in the triplets
92-
# knob powering. The individual triplet magnets trims are not affected.
97+
# knob powering. The individual triplet magnets trims are not affected. Here we
98+
# will use a setting of 1.5 to make the effect easily noticeable.
9399

94100
lhc.apply_lhc_rigidity_waist_shift_knob(madx, rigidty_waist_shift_value=1.5, ir=1)
95101
matching.match_tunes_and_chromaticities(madx, "lhc", "lhcb1", 62.31, 60.32, 2.0, 2.0)
@@ -120,7 +126,7 @@
120126

121127
###############################################################################
122128
# Comparing to the previous plot, one can notice two things:
123-
# - The triplet quadrupoles powering has changed and is not symmetric anymore.
129+
# - The triplet quadrupoles powering has changed and is not (anti-)symmetric anymore.
124130
# - The :math:`\beta_{x,y}` functions symmetry has been broken.
125131
#
126132
# One can compare the :math:`\beta_{x,y}` functions before and after the rigid
@@ -152,6 +158,8 @@
152158
madx.exit()
153159

154160
###############################################################################
161+
# Determining the Waist Shift
162+
# ---------------------------
155163
# Let's now determine the value of the waist, aka the amount by which we have
156164
# shifted the waist compared to the IP point location. To do so, we will use
157165
# both an analytical approach and a more brute force one through simulations.
@@ -258,7 +266,7 @@
258266
# The value of the waist is then simply the distance between the IP and the
259267
# location of the found minima. Here is the value, in meters:
260268

261-
shift = abs(ip_s - waist_location)
269+
shift = ip_s - waist_location
262270
print(shift)
263271

264272
###############################################################################
@@ -276,23 +284,21 @@
276284
# Manipulating the equation to determine the waist yields:
277285
# :math:`w = L^{*} - \sqrt{\beta_0 \beta_w - \beta_w^2}`
278286

279-
q1_right_s = twiss_df[twiss_df.name.str.contains(f"mqxa.1r1")].s[0]
280-
q1_left_s = twiss_df[twiss_df.name.str.contains(f"mqxa.1l1")].s[-1] # to calculate from the left
287+
q1_right_s = twiss_df[twiss_df.name.str.contains(f"mqxa.1r1")].s[0] # to calculate from the right Q1
288+
q1_left_s = twiss_df[twiss_df.name.str.contains(f"mqxa.1l1")].s[-1] # to calculate from the left Q1
281289

282-
L_star = ip_s - q1_left_s
283-
beta0 = twiss_df[twiss_df.name.str.contains(f"mqxa.1r1")].betx[0]
284-
# beta0 = twiss_df[twiss_df.name.str.contains(f"mqxa.1l{IP:d}")].betx[-1] # if calculating from the left
290+
L_star = ip_s - q1_left_s # we calculate from left Q1
291+
# beta0 = twiss_df[twiss_df.name.str.contains(f"mqxa.1r1")].betx[0] # to calculate from the right
292+
beta0 = twiss_df[twiss_df.name.str.contains(f"mqxa.1l1")].betx[-1] # to calculate from the left
285293
betaw = around_ip.betx.min()
286294

287295
###############################################################################
288296
# The analytical result (sign will swap depending on if we calculate from left
289-
# or right Q1) is then:
297+
# or right Q1) is then easily calculated. We can then compare this value to the
298+
# one found with the markers we previously added, and they are fairly close.
290299
waist = L_star - np.sqrt(beta0 * betaw - betaw**2)
291-
print(waist)
292-
293-
###############################################################################
294-
# It is fairly close to the value found with the markers we previously added:
295-
print(shift)
300+
print(waist) # analytical
301+
print(shift) # markers
296302

297303
#############################################################################
298304
#

pyhdtoolkit/maths/nonconvex_phase_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
5151
.. code-block:: python
5252
53-
C_matrix = np.exp(1j * :math:`\mathrm{M_matrix}`)
53+
C_matrix = np.exp(1j * M_matrix)
5454
5555
.. note::
5656
Since :math:`\mathrm{M_matrix}` is symmetric, then C_matrix will be Hermitian.

0 commit comments

Comments
 (0)