Skip to content

Commit e538dc0

Browse files
authored
Patch 1.1.1 (#100)
1 parent 3c70781 commit e538dc0

32 files changed

+637
-629
lines changed

docker/environment.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ dependencies:
200200
- stack_data=0.2.0
201201
- statsmodels=0.13.2
202202
- sympy=1.9
203-
- tfs-pandas=3.1.0
203+
- tfs-pandas=3.2.1
204204
- threadpoolctl=3.1.0
205205
- tk=8.6.12
206206
- tomli=2.0.1
@@ -225,6 +225,6 @@ dependencies:
225225
- importlib-resources==5.4.0
226226
- minrpc==0.1.0
227227
- optics-functions==0.1.2
228-
- pyhdtoolkit==1.1.0
228+
- pyhdtoolkit==1.1.1
229229
- pynaff==1.1.4
230-
- scipy==1.9.0
230+
- scipy==1.9.3

docs/release.rst

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ Release Notes
33

44
The full list of releases can be found in the GitHub repository's `releases page <https://github.com/fsoubelet/PyhDToolkit/releases>`_.
55

6+
Version 1.1.1
7+
-------------
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
releases/v1.1.1
13+
614
Version 1.1.0
715
-------------
816

docs/releases/v1.1.1.rst

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. _release_1.1.1:
2+
3+
1.1.1
4+
-----
5+
6+
Release `1.1.1` brings a few fixes and settings changes.
7+
8+
Bug Fixes
9+
~~~~~~~~~
10+
11+
* Various functions in the `~pyhdtoolkit.cpymadtools` submodules do not use the ``CHROM`` flag by default (in ``TWISS`` or matching routines). Providing ``CHROM`` is still possible through ``kwargs``.
12+
* Many calls to `.copy()` following a call to `.dframe()` when querying a ``MAD-X`` table have been removed, as they were redundant.
13+
* A few values in the available plotting settings were changed.
14+
15+
16+
See `v1.1.1 release notes on GitHub <https://github.com/fsoubelet/PyhDToolkit/releases/tag/1.1.1>`_ and the `full changes since v1.0.0 <https://github.com/fsoubelet/PyhDToolkit/compare/1.1.0...1.1.1>`_.

examples/demo_aperture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# We can now determine the exact position of the IP5 point and plot the LHC
4949
# injection aperture:
5050

51-
twiss_df = madx.table.twiss.dframe().copy()
51+
twiss_df = madx.table.twiss.dframe()
5252
ip5s = twiss_df.s[twiss_df.name.str.contains("ip5")].to_numpy()[0]
5353

5454
###############################################################################

examples/demo_ir_errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
madx.command.use(sequence="lhcb1")
7474
matching.match_tunes_and_chromaticities(madx, "lhc", "lhcb1", 62.31, 60.32, 2.0, 2.0)
75-
error_table = madx.table.ir_quads_errors.dframe().copy()
75+
error_table = madx.table.ir_quads_errors.dframe()
7676

7777
###############################################################################
7878
# Let's quickly re-arrange the resulting `~pandas.DataFrame` to align with the

examples/demo_lattice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# of points of interest through the ``TWISS`` table:
9090

9191
lhc_madx.command.twiss()
92-
twiss_df = lhc_madx.table.twiss.dframe().copy()
92+
twiss_df = lhc_madx.table.twiss.dframe()
9393
twiss_df.name = twiss_df.name.apply(lambda x: x[:-2])
9494
ip1s = twiss_df.s["ip1"]
9595

examples/demo_lhc_rigid_waist_shift.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# determine the position of points of interest through the ``TWISS`` table:
5858

5959
madx.command.twiss()
60-
twiss_df = madx.table.twiss.dframe().copy()
60+
twiss_df = madx.table.twiss.dframe()
6161
twiss_df.name = twiss_df.name.apply(lambda x: x[:-2])
6262
ip1s = twiss_df.s["ip1"]
6363

@@ -104,7 +104,7 @@
104104
# Let's again retrieve the ``TWISS`` table, then plot the new conditions in the
105105
# Interaction Region.
106106

107-
twiss_df_waist = madx.table.twiss.dframe().copy()
107+
twiss_df_waist = madx.table.twiss.dframe()
108108
twiss_df_waist.name = twiss_df.name.apply(lambda x: x[:-2])
109109
ip1s = twiss_df_waist.s["ip1"]
110110

@@ -186,7 +186,7 @@
186186
lhc.make_lhc_thin(madx, sequence=f"lhcb1", slicefactor=4)
187187
lhc.add_markers_around_lhc_ip(madx, sequence=f"lhcb1", ip=1, n_markers=1000, interval=0.001)
188188
madx.command.twiss()
189-
initial_twiss = madx.table.twiss.dframe().copy()
189+
initial_twiss = madx.table.twiss.dframe()
190190

191191
# Calling pre-calculated and re-matched waist shift knobs
192192
for knobfile in b1_knobs:
@@ -197,7 +197,7 @@
197197
matching.match_tunes_and_chromaticities(madx, "lhc", f"lhcb1", 62.31, 60.32, 2.0, 2.0)
198198

199199
madx.command.twiss()
200-
twiss_df = madx.table.twiss.dframe().copy()
200+
twiss_df = madx.table.twiss.dframe()
201201

202202
###############################################################################
203203
# We will use all our added markers to determine the location of the waist,

pyhdtoolkit/cpymadtools/coupling.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ def get_closest_tune_approach(
5151
This assumes the sequence has previously been matched to the user's desired working point, as if not
5252
explicitely given, the appropriate targets will be determined from the ``MAD-X`` internal tables.
5353
54-
.. important::
55-
This is hard-coded to use the ``CHROM`` flag when performing matching, since we expect to be in
56-
the presence of betatron coupling. In this case, attempting to match chromaticities at the same time as the
57-
tunes might cause ``LMDIF`` to fail, as the knobs become dependent. For this reason, only tune matching is
58-
performed here, and chromaticities are voluntarily ignored.
59-
6054
Args:
6155
madx (cpymad.madx.Madx): an instanciated `~cpymad.madx.Madx` object.
6256
accelerator (Optional[str]): name of the accelerator, used to determmine knobs if *variables* is not given.
@@ -99,7 +93,7 @@ def get_closest_tune_approach(
9993
tune_knobs, _ = lhc_knobs[:2], lhc_knobs[2:] # first two for tune & last two for chroma, not used
10094

10195
logger.debug("Running TWISS to update SUMM and TWISS tables")
102-
madx.command.twiss(chrom=True)
96+
madx.command.twiss()
10397

10498
logger.debug("Saving knob values to restore after closest tune approach")
10599
varied_knobs = varied_knobs or tune_knobs # if accelerator was given we've extracted this already
@@ -142,7 +136,7 @@ def get_closest_tune_approach(
142136
logger.debug("Restoring saved knobs")
143137
with madx.batch():
144138
madx.globals.update(saved_knobs)
145-
madx.command.twiss(chrom=True) # make sure TWISS and SUMM tables are returned to their original state
139+
madx.command.twiss() # make sure TWISS and SUMM tables are returned to their original state
146140

147141
return cminus
148142

@@ -206,7 +200,7 @@ def get_cminus_from_coupling_rdts(
206200
>>> complex_cminus = get_cminus_from_coupling_rdts(madx, patterns=["^BPM.*B[12]$"])
207201
"""
208202
logger.debug(f"Getting coupling RDTs at selected elements thoughout the machine")
209-
twiss_with_rdts = get_pattern_twiss(madx, patterns=patterns, columns=MONITOR_TWISS_COLUMNS, chrom=True)
203+
twiss_with_rdts = get_pattern_twiss(madx, patterns=patterns, columns=MONITOR_TWISS_COLUMNS)
210204
twiss_with_rdts.columns = twiss_with_rdts.columns.str.upper() # optics_functions needs capitalized names
211205
twiss_with_rdts[["F1001", "F1010"]] = coupling_via_cmatrix(twiss_with_rdts, output=["rdts"])
212206

@@ -263,7 +257,7 @@ def match_no_coupling_through_ripkens(
263257
madx.input("do_ripken: macro = {twiss, ripken=True;}") # cpymad needs .input for macros
264258

265259
logger.debug("Matching Parameters")
266-
madx.command.match(sequence=sequence, use_macro=True, chrom=True)
260+
madx.command.match(sequence=sequence, use_macro=True)
267261
for knob in vary_knobs:
268262
madx.command.vary(name=knob)
269263
madx.command.use_macro(name="do_ripken")
@@ -283,7 +277,6 @@ def get_coupling_rdts(madx: Madx, **kwargs) -> tfs.TfsDataFrame:
283277
Args:
284278
madx (cpymad.madx.Madx): an instanciated `~cpymad.madx.Madx` object.
285279
**kwargs: any keyword argument will be transmitted to the ``TWISS`` command in ``MAD-X``.
286-
Note that ``CHROM`` is already provided as it is needed for the RDTs' calculation.
287280
288281
Returns:
289282
A `~tfs.TfsDataFrame` with columns of the ``TWISS`` table, and two complex columns for the
@@ -294,7 +287,7 @@ def get_coupling_rdts(madx: Madx, **kwargs) -> tfs.TfsDataFrame:
294287
295288
>>> twiss_rdts = get_coupling_rdts(madx)
296289
"""
297-
twiss_tfs = get_twiss_tfs(madx, chrom=True, **kwargs)
290+
twiss_tfs = get_twiss_tfs(madx, **kwargs)
298291
twiss_tfs[["F1001", "F1010"]] = coupling_via_cmatrix(twiss_tfs, output=["rdts"])
299292
return twiss_tfs
300293

pyhdtoolkit/cpymadtools/lhc/_coupling.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def correct_lhc_global_coupling(
4949

5050
real_knob, imag_knob = f"CMRS.b{beam:d}{suffix}", f"CMIS.b{beam:d}{suffix}"
5151
logger.debug(f"Matching using the coupling knobs '{real_knob}' and '{imag_knob}'")
52-
madx.command.match(chrom=True, sequence=sequence)
52+
madx.command.match(sequence=sequence)
5353
madx.command.gweight(dqmin=1, Q1=0)
5454
madx.command.global_(dqmin=0, Q1=62.28)
5555
madx.command.vary(name=real_knob, step=1.0e-8)
@@ -77,9 +77,7 @@ def get_lhc_bpms_twiss_and_rdts(madx: Madx) -> tfs.TfsDataFrame:
7777
7878
>>> twiss_with_rdts = get_lhc_bpms_twiss_and_rdts(madx)
7979
"""
80-
twiss_tfs = twiss.get_pattern_twiss( # need chromatic flag as we're dealing with coupling
81-
madx, patterns=["^BPM.*B[12]$"], columns=MONITOR_TWISS_COLUMNS, chrom=True
82-
)
80+
twiss_tfs = twiss.get_pattern_twiss(madx, patterns=["^BPM.*B[12]$"], columns=MONITOR_TWISS_COLUMNS)
8381
twiss_tfs.columns = twiss_tfs.columns.str.upper() # optics_functions needs capitalized names
8482
twiss_tfs.NAME = twiss_tfs.NAME.str.upper()
8583
twiss_tfs[["F1001", "F1010"]] = coupling_via_cmatrix(twiss_tfs, output=["rdts"])

pyhdtoolkit/cpymadtools/lhc/_misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,6 @@ def get_sizes_at_ip(madx: Madx, ip: int, geom_emit_x: float = None, geom_emit_y:
197197
geom_emit_x = geom_emit_x or madx.globals["geometric_emit_x"]
198198
geom_emit_y = geom_emit_y or madx.globals["geometric_emit_y"]
199199

200-
twiss_tfs = twiss.get_twiss_tfs(madx, chrom=True, ripken=True)
200+
twiss_tfs = twiss.get_twiss_tfs(madx, ripken=True)
201201
twiss_tfs = _add_beam_size_to_df(twiss_tfs, geom_emit_x, geom_emit_y)
202202
return twiss_tfs.loc[f"IP{ip:d}"].SIZE_X, twiss_tfs.loc[f"IP{ip:d}"].SIZE_Y

pyhdtoolkit/cpymadtools/lhc/_routines.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def correct_lhc_global_coupling(
129129

130130
real_knob, imag_knob = f"CMRS.b{beam:d}{suffix}", f"CMIS.b{beam:d}{suffix}"
131131
logger.debug(f"Matching using the coupling knobs '{real_knob}' and '{imag_knob}'")
132-
madx.command.match(chrom=True, sequence=sequence)
132+
madx.command.match(sequence=sequence)
133133
madx.command.gweight(dqmin=1, Q1=0)
134134
madx.command.global_(dqmin=0, Q1=62.28)
135135
madx.command.vary(name=real_knob, step=1.0e-8)
@@ -181,6 +181,6 @@ def correct_lhc_orbit(
181181

182182
for _ in range(iterations):
183183
logger.trace("Doing orbit correction for Y then X plane")
184-
madx.twiss(chrom=True)
184+
madx.command.twiss()
185185
madx.command.correct(sequence=sequence, plane="y", flag="ring", error=orbit_tolerance, mode=mode, **kwargs)
186186
madx.command.correct(sequence=sequence, plane="x", flag="ring", error=orbit_tolerance, mode=mode, **kwargs)

pyhdtoolkit/cpymadtools/matching.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def match_tunes_and_chromaticities(
6666
If explicit knobs are provided, these will always be used. On other machines the knobs should be provided
6767
explicitly, always.
6868
69-
.. important::
70-
The matching is always performed with the ``CHROM`` option on.
71-
7269
Args:
7370
madx (cpymad.madx.Madx): an instanciated `~cpymad.madx.Madx` object.
7471
accelerator (Optional[str]): name of the accelerator, used to determmine knobs if *variables* is not given.
@@ -129,7 +126,7 @@ def match_tunes_and_chromaticities(
129126
def match(*args, **kwargs):
130127
"""Create matching commands for kwarg targets, varying the given args."""
131128
logger.debug(f"Executing matching commands, using sequence '{sequence}'")
132-
madx.command.match(chrom=True)
129+
madx.command.match()
133130
logger.trace(f"Targets are given as {kwargs}")
134131
madx.command.global_(sequence=sequence, **kwargs)
135132
for variable_name in args:
@@ -138,7 +135,7 @@ def match(*args, **kwargs):
138135
madx.command.lmdif(calls=calls, tolerance=tolerance)
139136
madx.command.endmatch()
140137
logger.trace("Performing routine TWISS")
141-
madx.twiss(chrom=True) # prevents errors if the user forgets to TWISS before querying tables
138+
madx.command.twiss() # prevents errors if the user forgets to TWISS before querying tables
142139

143140
# Case of a combined matching: both tune and chroma targets have been provided
144141
if q1_target is not None and q2_target is not None and dq1_target is not None and dq2_target is not None:
@@ -191,9 +188,6 @@ def match_tunes(
191188
This is a wrapper around the `~.match_tunes_and_chromaticities` function. Refer to its documentation
192189
for usage details.
193190
194-
.. important::
195-
The matching is always performed with the ``CHROM`` option on.
196-
197191
Args:
198192
madx (cpymad.madx.Madx): an instanciated `~cpymad.madx.Madx` object.
199193
accelerator (Optional[str]): name of the accelerator, used to determmine knobs if *variables* is not given.
@@ -275,9 +269,6 @@ def match_chromaticities(
275269
This is a wrapper around the `~.match_tunes_and_chromaticities` function. Refer to its documentation
276270
for usage details.
277271
278-
.. important::
279-
The matching is always performed with the ``CHROM`` option on.
280-
281272
Args:
282273
madx (cpymad.madx.Madx): an instanciated `~cpymad.madx.Madx` object.
283274
accelerator (Optional[str]): name of the accelerator, used to determmine knobs if *variables* is not given.

pyhdtoolkit/cpymadtools/ptc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ def ptc_track_particle(
333333

334334
if onetable: # user asked for ONETABLE, there will only be one table 'trackone' given back by MAD-X
335335
logger.debug("Because of option ONETABLE only one table 'TRACKONE' exists to be returned.")
336-
return {"trackone": madx.table.trackone.dframe().copy()}
336+
return {"trackone": madx.table.trackone.dframe()}
337337
return {
338-
f"observation_point_{point:d}": madx.table[f"track.obs{point:04d}.p0001"].dframe().copy()
338+
f"observation_point_{point:d}": madx.table[f"track.obs{point:04d}.p0001"].dframe()
339339
for point in range(1, len(observation_points) + 2) # len(observation_points) + 1 for start of
340340
# machine + 1 because MAD-X starts indexing these at 1
341341
}

pyhdtoolkit/cpymadtools/track.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def track_single_particle(
9292
madx.command.endtrack()
9393
if onetable: # user asked for ONETABLE, there will only be one table 'trackone' given back by MAD-X
9494
logger.debug("Because of option ONETABLE only one table 'TRACKONE' exists to be returned.")
95-
return {"trackone": madx.table.trackone.dframe().copy()}
95+
return {"trackone": madx.table.trackone.dframe()}
9696
return {
97-
f"observation_point_{point:d}": madx.table[f"track.obs{point:04d}.p0001"].dframe().copy()
97+
f"observation_point_{point:d}": madx.table[f"track.obs{point:04d}.p0001"].dframe()
9898
for point in range(1, len(observation_points) + 2) # len(observation_points) + 1 for start of
9999
# machine + 1 because MAD-X starts indexing these at 1
100100
}

pyhdtoolkit/cpymadtools/twiss.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def get_pattern_twiss(
8686
madx.twiss(**kwargs)
8787

8888
logger.trace("Extracting relevant parts of the TWISS table")
89-
twiss_df = tfs.TfsDataFrame(madx.table.twiss.dframe().copy())
89+
twiss_df = tfs.TfsDataFrame(madx.table.twiss.dframe())
9090
twiss_df.headers = {var.upper(): madx.table.summ[var][0] for var in madx.table.summ}
9191
twiss_df = twiss_df[madx.table.twiss.selected_columns()].iloc[madx.table.twiss.selected_rows()]
9292

pyhdtoolkit/optics/ripken.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def lebedev_beam_size(
4545
4646
>>> geom_emit_x = madx.globals["geometric_emit_x"]
4747
>>> geom_emit_y = madx.globals["geometric_emit_y"]
48-
>>> twiss_tfs = madx.twiss(ripken=True).dframe().copy()
48+
>>> twiss_tfs = madx.twiss(ripken=True).dframe()
4949
>>> horizontal_size = lebedev_beam_size(
5050
twiss_tfs.beta11, twiss_tfs.beta21, geom_emit_x, geom_emit_y
5151
)

pyhdtoolkit/plotting/aperture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def plot_aperture(
9898
logger.debug("Plotting aperture limits and machine layout")
9999
logger.debug("Getting Twiss dataframe from cpymad")
100100
madx.command.twiss(centre=True)
101-
twiss_df: pd.DataFrame = madx.table.twiss.dframe().copy()
101+
twiss_df: pd.DataFrame = madx.table.twiss.dframe()
102102
aperture_df = pd.DataFrame.from_dict(dict(madx.table.aperture)) # slicing -> issues with .dframe()
103103

104104
# Restrict the span of twiss_df to avoid plotting all elements then cropping when xlimits is given

pyhdtoolkit/plotting/crossing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def plot_two_lhc_ips_crossings(
7070
logger.debug("Getting TWISS table for LHCB1")
7171
madx.use(sequence="lhcb1")
7272
madx.command.twiss(centre=True)
73-
twiss_df_b1 = madx.table.twiss.dframe().copy()
73+
twiss_df_b1 = madx.table.twiss.dframe()
7474

7575
logger.debug("Getting TWISS table for LHCB2")
7676
madx.use(sequence="lhcb2")
7777
madx.command.twiss(centre=True)
78-
twiss_df_b2 = madx.table.twiss.dframe().copy()
78+
twiss_df_b2 = madx.table.twiss.dframe()
7979

8080
logger.trace("Determining exact locations of IP points")
8181
first_ip_s = twiss_df_b1.s[f"ip{first_ip}"]

pyhdtoolkit/plotting/envelope.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ def _interpolate_madx(madx: Madx) -> None:
172172
def _get_twiss_hr_from_madx(madx: Madx, beam_params: BeamParameters) -> pd.DataFrame:
173173
"""Get twiss hr from the provided MAD-X instance."""
174174
logger.trace("Getting Twiss dframe from MAD-X")
175-
twiss_hr: pd.DataFrame = madx.table.twiss.dframe().copy()
175+
twiss_hr: pd.DataFrame = madx.table.twiss.dframe()
176176
twiss_hr["betatronic_envelope_x"] = np.sqrt(twiss_hr.betx * beam_params.eg_x_m)
177177
twiss_hr["betatronic_envelope_y"] = np.sqrt(twiss_hr.bety * beam_params.eg_y_m)
178178
twiss_hr["dispersive_envelope_x"] = twiss_hr.dx * beam_params.deltap_p
179179
twiss_hr["dispersive_envelope_y"] = twiss_hr.dy * beam_params.deltap_p
180-
twiss_hr["envelope_x"] = np.sqrt(twiss_hr.betatronic_envelope_x**2 + (twiss_hr.dx * beam_params.deltap_p) ** 2)
181-
twiss_hr["envelope_y"] = np.sqrt(twiss_hr.betatronic_envelope_y**2 + (twiss_hr.dy * beam_params.deltap_p) ** 2)
180+
twiss_hr["envelope_x"] = np.sqrt(twiss_hr.betatronic_envelope_x ** 2 + (twiss_hr.dx * beam_params.deltap_p) ** 2)
181+
twiss_hr["envelope_y"] = np.sqrt(twiss_hr.betatronic_envelope_y ** 2 + (twiss_hr.dy * beam_params.deltap_p) ** 2)
182182
return twiss_hr

pyhdtoolkit/plotting/styles/paper.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
SINGLE_COLUMN: Dict[str, PlotSetting] = {
2222
# ------ Lines ------ #
2323
"lines.linewidth": 1.3, # Width of plot lines
24-
"lines.markersize": 2, # Marker size, in points
24+
"lines.markersize": 5, # Marker size, in points
2525
# ------ Patches ------ #
2626
"patch.linewidth": 1.2, # Width of patches edge lines
2727
# ------ Fonts ------ #
@@ -54,7 +54,7 @@
5454
"legend.frameon": True, # Make a dedicated patch for the legend
5555
"legend.framealpha": 0.85, # Legend patch transparency factor
5656
"legend.fancybox": True, # Use rounded box for legend background
57-
"legend.fontsize": 24, # Legend text font size
57+
"legend.fontsize": 20, # Legend text font size
5858
# ------ Figure ------ #
5959
"figure.figsize": (11, 7), # Size of the figure
6060
"figure.titlesize": 20, # Size of the figure title

pyhdtoolkit/plotting/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def make_survey_groups(madx: Madx) -> Dict[str, pd.DataFrame]:
201201
logger.debug("Getting different element groups dframes from MAD-X survey")
202202
madx.command.survey()
203203

204-
survey_df = madx.table.survey.dframe().copy()
204+
survey_df = madx.table.survey.dframe()
205205
return {
206206
"dipoles": survey_df[survey_df.index.isin(element_dfs["dipoles"].index.tolist())],
207207
"quad_foc": survey_df[survey_df.index.isin(quadrupoles_focusing_df.index.tolist())],
@@ -356,7 +356,7 @@ def _get_twiss_table_with_offsets_and_limits(
356356
# Restrict the span of twiss_df to avoid plotting all elements then cropping when xlimits is given
357357
logger.trace("Getting TWISS table from MAD-X")
358358
madx.command.twiss()
359-
twiss_df = madx.table.twiss.dframe().copy()
359+
twiss_df = madx.table.twiss.dframe()
360360
twiss_df.s = twiss_df.s - xoffset
361361
twiss_df = twiss_df[twiss_df.s.between(*xlimits)] if xlimits else twiss_df
362362
return twiss_df

pyhdtoolkit/utils/_misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def apply_colin_corrs_balance(madx: Madx) -> None:
8686
lhc.misalign_lhc_ir_quadrupoles(madx, ips=[8], beam=1, quadrupoles=[3], sides="R", DPSI=1e-3)
8787
madx.globals["kqsx3.l8"] = -5e-4
8888
madx.globals["kqsx3.r8"] = -5e-4
89-
madx.command.twiss(chrom=True)
89+
madx.command.twiss()
9090

9191

9292
# ----- Fetching Utilities ----- #

0 commit comments

Comments
 (0)