Skip to content

Commit 4dd8b48

Browse files
authored
[FIX] Invalid escape sequences in docstrings (#36)
1 parent 63b8f0c commit 4dd8b48

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# optics_functions Changelog
22

3+
## Version 0.1.4
4+
5+
- Fixed invalid escape sequences in docstrings that would warn in all calling code.
6+
37
## Version 0.1.3
48

59
- Fixed use of `np.NaN` to ensure compatibility with `numpy 2.0`.

optics_functions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__title__ = "optics_functions"
66
__description__ = "Calculate optics parameters from TWISS outputs."
77
__url__ = "https://github.com/pylhc/optics_functions"
8-
__version__ = "0.1.3"
8+
__version__ = "0.1.4"
99
__author__ = "pylhc"
1010
__author_email__ = "pylhc@github.com"
1111
__license__ = "MIT"

optics_functions/coupling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _get_weights_from_lengths(df: TfsDataFrame) -> Tuple[float, np.array]:
349349

350350

351351
def check_resonance_relation(df: DataFrame, to_nan: bool = False) -> DataFrame:
352-
"""Checks that \|F1001| >= \|F1010|.
352+
r"""Checks that \|F1001| >= \|F1010|.
353353
If desired, sets the invalid points to NaN. This is only used for checking
354354
in the :func:`~optics_functions.coupling.closest_tune_approach` function,
355355
but can be invoked by the user with ``to_nan = True`` and the resulting

optics_functions/rdt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def calculate_rdts(df: TfsDataFrame, rdts: Sequence[str],
2727
qx: float = None, qy: float = None, feeddown: int = 0,
2828
complex_columns: bool = True, loop_phases: bool = False,
2929
hamiltionian_terms: bool = False) -> TfsDataFrame:
30-
""" Calculates the Resonance Driving Terms.
30+
r"""Calculates the Resonance Driving Terms.
3131
3232
Eq. (A8) in [FranchiAnalyticFormulas2017]_ .
3333
One might notice that this code implementation has a factor :math:`2 \pi` in the exponential

tests/unit/test_coupling.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_closest_tune_approach(
114114
df_twiss[F1001] = df_cmatrix[F1001] # ignoring F1010 in this test as it is bigger than F1001
115115

116116
cta_df = closest_tune_approach(df_twiss, method=cta_method) # only one column
117-
cminus = cta_df.mean().abs()[0]
117+
cminus = cta_df.mean().abs().iloc[0]
118118
relative_error = _relative_error(cminus, _coupling_bump_teapot_cta)
119119

120120
assert relative_error <= max_relative_error_to_teapot
@@ -176,12 +176,13 @@ def test_coupling_rdt_bump_cmatrix_compare():
176176

177177
def generate_fake_data(n) -> tfs.TfsDataFrame:
178178
qx, qy = 1.31, 1.32
179-
df = tfs.TfsDataFrame(0,
180-
index=[str(i) for i in range(n)],
181-
columns=[S, f"{ALPHA}{X}", f"{ALPHA}{Y}", f"{BETA}{X}", f"{BETA}{Y}",
182-
f"{PHASE_ADV}{X}", f"{PHASE_ADV}{Y}", "R11", "R12", "R21", "R22"],
183-
headers={f"{TUNE}1": qx, f"{TUNE}2": qy}
184-
)
179+
df = tfs.TfsDataFrame(
180+
0.0,
181+
index=[str(i) for i in range(n)],
182+
columns=[S, f"{ALPHA}{X}", f"{ALPHA}{Y}", f"{BETA}{X}", f"{BETA}{Y}",
183+
f"{PHASE_ADV}{X}", f"{PHASE_ADV}{Y}", "R11", "R12", "R21", "R22"],
184+
headers={f"{TUNE}1": qx, f"{TUNE}2": qy},
185+
)
185186

186187
r = np.random.rand(n)
187188
df[S] = np.linspace(0, n, n)
@@ -211,4 +212,4 @@ def _coupling_bump_teapot_cta() -> float:
211212
df_twiss[F1001] = df_cmatrix[F1001] # ignoring F1010 in this test as it is bigger than F1001
212213

213214
cta_df = closest_tune_approach(df_twiss, method="teapot") # only one column
214-
return cta_df.mean().abs()[0] # this is the cminus
215+
return cta_df.mean().abs().iloc[0] # this is the cminus

0 commit comments

Comments
 (0)