Skip to content

Commit 6da2b55

Browse files
authored
Indexing fix in CTA calculation (#31)
1 parent 996e558 commit 6da2b55

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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.1"
8+
__version__ = "0.1.2"
99
__author__ = "pylhc"
1010
__author_email__ = "[email protected]"
1111
__license__ = "MIT"

optics_functions/coupling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def _get_weights_from_lengths(df: TfsDataFrame) -> Tuple[float, np.array]:
341341
# approximate length of each element (ds in integral)
342342
s_periodic = np.zeros(len(df) + 1)
343343
s_periodic[1:] = df[S].to_numpy()
344-
s_periodic[0] = df[S][-1] - df.headers[LENGTH]
344+
s_periodic[0] = df[S].to_numpy()[-1] - df.headers[LENGTH]
345345

346346
# weight ds/(2*pi*R) * N (as we take the mean afterwards)
347347
weights = np.diff(s_periodic) / df.headers[LENGTH] * len(df)

0 commit comments

Comments
 (0)