Skip to content

Commit 1c3bd66

Browse files
committed
Runtime Warnings for load_file
1 parent 0e6e868 commit 1c3bd66

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

src/python/impactx/extensions/KnownElementsList.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,26 @@
1313

1414

1515
def load_file(self, filename, nslice=1):
16-
"""Load and append a lattice file from MAD-X (.madx) or PALS (e.g., .pals.yaml) formats."""
16+
"""Load and append a lattice file from MAD-X (.madx) or PALS (e.g., .pals.yaml) formats.
17+
18+
.. warning::
19+
20+
Our MAD-X and PALS parsers are under active development
21+
and provided as a preview. Please check any loaded lattice
22+
files very carefully. Please report your experience and bugs
23+
on our `issue tracker <https://github.com/BLAST-ImpactX/impactx/issues>`__.
24+
"""
25+
26+
import warnings
27+
28+
warnings.warn(
29+
"Our MAD-X and PALS parsers are under active development and provided as a "
30+
"preview. Please check any loaded lattice files very carefully. Please "
31+
"report your experience and bugs on our issue tracker: "
32+
"https://github.com/BLAST-ImpactX/impactx/issues",
33+
RuntimeWarning,
34+
stacklevel=2,
35+
)
1736

1837
# Attempt to strip two levels of file extensions to determine the schema.
1938
# Examples: fodo.madx, fodo.pals.yaml, fodo.pals.json, ...

src/python/impactx/madx_to_impactx.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,10 +1106,28 @@ def beam(particle, charge=None, mass=None, energy=None):
11061106
def read_beam(ref: RefPart, madx_file):
11071107
"""
11081108
Function that reads elements from a MAD-X file into a list of ImpactX.KnownElements
1109+
1110+
.. warning::
1111+
1112+
Our MAD-X parser is under active development and provided
1113+
as a preview. Please check any loaded MAD-X beams very
1114+
carefully. Please report your experience and bugs on our
1115+
`issue tracker <https://github.com/BLAST-ImpactX/impactx/issues>`__.
1116+
11091117
:param RefPart ref: ImpactX reference particle (passed by reference)
11101118
:param madx_file: file name to MAD-X file with beamline elements
11111119
:return: list of ImpactX.KnownElements
11121120
"""
1121+
1122+
warnings.warn(
1123+
"Our MAD-X parser is under active development and provided as a preview. "
1124+
"Please check any loaded MAD-X beams very carefully. Please report your "
1125+
"experience and bugs on our issue tracker: "
1126+
"https://github.com/BLAST-ImpactX/impactx/issues",
1127+
RuntimeWarning,
1128+
stacklevel=2,
1129+
)
1130+
11131131
madx = MADXParser()
11141132
madx.parse(madx_file)
11151133

0 commit comments

Comments
 (0)