Skip to content

Commit 49f7d04

Browse files
committed
Clarify type annotations in convert_to_tbt functions for consistency and accuracy
1 parent 283b751 commit 49f7d04

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

turn_by_turn/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ def read_tbt(file_path: str | Path, datatype: str = "lhc") -> TbtData:
164164
# Note: I don't specify tfs.TfsDataFrame as this inherits from pandas.DataFrame
165165
def convert_to_tbt(file_data: DataFrame | Line, datatype: str = "xtrack") -> TbtData:
166166
"""
167-
Convert a pandas or tfs DataFrame (MAD-NG) or a Table (XTrack) to a TbtData object.
167+
Convert a pandas or tfs DataFrame (MAD-NG) or a Line (XTrack) to a TbtData object.
168168
Args:
169-
file_data (Union[DataFrame, Table]): The data to convert.
169+
file_data (Union[DataFrame, xt.Line]): The data to convert.
170170
datatype (str): The type of the data, either 'xtrack' or 'madng'. Defaults to 'xtrack'.
171171
Returns:
172172
TbtData: The converted TbtData object.

turn_by_turn/xtrack_line.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def convert_to_tbt(xline: xt.Line) -> TbtData:
9191
monitor_pairs = [
9292
(name, elem)
9393
for name, elem in zip(xline.element_names, xline.elements)
94-
if isinstance(elem, xt.ParticlesMonitor | xt.BeamPositionMonitor)
94+
if isinstance(elem, xt.ParticlesMonitor)
9595
]
9696
# Check that we have at least one monitor
9797
if not monitor_pairs:
9898
raise ValueError(
99-
"No ParticlesMonitor or BeamPositionMonitor found in the Line. Please add a ParticlesMonitor or BeamPositionMonitor to the Line."
99+
"No ParticlesMonitor found in the Line. Please add a ParticlesMonitor to the Line."
100100
)
101101
monitor_names, monitors = zip(*monitor_pairs)
102102

0 commit comments

Comments
 (0)