Skip to content

Commit a498655

Browse files
committed
checked with matching
1 parent 5f2bbd1 commit a498655

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

pyat/at/lattice/axisdef.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Helper functions for axis and plane descriptions"""
2+
23
from __future__ import annotations
34
from typing import Optional, Union
5+
46
# For sys.version_info.minor < 9:
57
from typing import Tuple
68

@@ -16,31 +18,31 @@
1618
ct=dict(index=5, label=r"$\beta c \tau$", unit=" [m]"),
1719
)
1820
for xk, xv in [it for it in _axis_def.items()]:
19-
xv['code'] = xk
20-
_axis_def[xv['index']] = xv
21+
xv["code"] = xk
22+
_axis_def[xv["index"]] = xv
2123
_axis_def[xk.upper()] = xv
22-
_axis_def['delta'] = _axis_def['dp']
23-
_axis_def['xp'] = _axis_def['px'] # For backward compatibility
24-
_axis_def['yp'] = _axis_def['py'] # For backward compatibility
25-
_axis_def['s'] = _axis_def['ct']
26-
_axis_def['S'] = _axis_def['ct']
27-
_axis_def[None] = dict(index=slice(None), label="", unit="", code=":")
24+
_axis_def["delta"] = _axis_def["dp"]
25+
_axis_def["xp"] = _axis_def["px"] # For backward compatibility
26+
_axis_def["yp"] = _axis_def["py"] # For backward compatibility
27+
_axis_def["s"] = _axis_def["ct"]
28+
_axis_def["S"] = _axis_def["ct"]
29+
_axis_def[None] = dict(index=None, label="", unit="", code=":")
2830
_axis_def[Ellipsis] = dict(index=Ellipsis, label="", unit="", code="...")
2931

3032
_plane_def = dict(
3133
x=dict(index=0, label="x", unit=" [m]"),
3234
y=dict(index=1, label="y", unit=" [m]"),
33-
z=dict(index=2, label="z", unit="")
35+
z=dict(index=2, label="z", unit=""),
3436
)
3537
for xk, xv in [it for it in _plane_def.items()]:
36-
xv['code'] = xk
37-
_plane_def[xv['index']] = xv
38+
xv["code"] = xk
39+
_plane_def[xv["index"]] = xv
3840
_plane_def[xk.upper()] = xv
39-
_plane_def['h'] = _plane_def['x']
40-
_plane_def['v'] = _plane_def['y']
41-
_plane_def['H'] = _plane_def['x']
42-
_plane_def['V'] = _plane_def['y']
43-
_plane_def[None] = dict(index=slice(None), label="", unit="", code=":")
41+
_plane_def["h"] = _plane_def["x"]
42+
_plane_def["v"] = _plane_def["y"]
43+
_plane_def["H"] = _plane_def["x"]
44+
_plane_def["V"] = _plane_def["y"]
45+
_plane_def[None] = dict(index=None, label="", unit="", code=":")
4446
_plane_def[Ellipsis] = dict(index=Ellipsis, label="", unit="", code="...")
4547

4648

pyat/at/latticetools/observablelist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def ringeval(
316316
# Emittance computation
317317
try:
318318
emdata = ring.envelope_parameters(orbit=o0, keep_lattice=True)
319-
except AtError as err:
319+
except Exception as err:
320320
emdata = err
321321

322322
if Need.GEOMETRY in needs:

pyat/at/latticetools/observables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def _all_lines(self):
464464
vmin = repeat(None)
465465
vmax = repeat(None)
466466
else:
467-
target = np.broadcast_to(self.target, (len(self._locations),))
467+
target = np.broadcast_to(self.target, np.asarray(vnow).shape)
468468
vmin = target + self.lbound
469469
vmax = target + self.ubound
470470
vini = self.initial

0 commit comments

Comments
 (0)