Skip to content

Commit ed55b08

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

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

src/python/impactx/extensions/KnownElementsList.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,30 @@
88

99
import os
1010
import re
11+
import warnings
1112

1213
from impactx import elements
1314

1415

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

1836
# Attempt to strip two levels of file extensions to determine the schema.
1937
# 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)