Skip to content

Commit 93985c6

Browse files
committed
Add conditional handling for day1 lattice types in get_sext_inds
- For day1_bare and day1_3dw lattices, expect all 270 sextupoles - For other lattice types, expect 264 + 6 CBSH* sextupoles - Prevents assertion failures with day1 lattice variants
1 parent 1d5abba commit 93985c6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/pyelegant/ltemanager.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,12 +2384,15 @@ def get_sext_elem_inds(self):
23842384
LTE = self.LTE
23852385

23862386
inds = LTE.get_elem_inds_from_regex(r"^S[HLM]\w+$")
2387-
assert len(inds) == 270 - 6 # 6 sextupoles have been renamed to "CBSH*"
2387+
if self.lat_type in ("day1_bare", "day1_3dw"):
2388+
assert len(inds) == 270
2389+
else:
2390+
assert len(inds) == 270 - 6 # 6 sextupoles have been renamed to "CBSH*"
23882391

2389-
dedicated_inds = LTE.get_elem_inds_from_regex(r"^CBSH[1-4]\w+$")
2390-
assert len(dedicated_inds) == 6
2392+
dedicated_inds = LTE.get_elem_inds_from_regex(r"^CBSH[1-4]\w+$")
2393+
assert len(dedicated_inds) == 6
23912394

2392-
inds = np.sort(np.concatenate((inds, dedicated_inds)))
2395+
inds = np.sort(np.concatenate((inds, dedicated_inds)))
23932396

23942397
return inds
23952398

0 commit comments

Comments
 (0)