Skip to content

Translate rectangular face angles, bend angles and RF gradients to Bmad - #3

Merged
DavidSagan merged 1 commit into
mainfrom
translator-fixes
Oct 17, 2026
Merged

DavidSagan merged 1 commit into
mainfrom
translator-fixes

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

Fixes three PALS-to-Bmad translation bugs:

  • e1_rect / e2_rect wrote bendP["e1"] (failing when only e1_rect was given) and never converted the angle. They now become Bmad's sector e1/e2, adding the share of the bend angle that ref_geometry gives each face (bend.md): half each for ARC/CHORD, all on the exit face for ENTRANCE_COORDS, all on the entrance face for EXIT_COORDS. The angle is taken from angle_ref, or worked out from g_ref/radius_ref with length, L_chord or L_rectangle. A face may now be given the sector way while the other is given the rectangular way; giving one face both ways is still an error.
  • angle_ref was dropped, so a bend stated by its angle came out straight. It now becomes Bmad's angle.
  • RF gradient read a nonexistent props["L"] and so always errored. It now becomes voltage = gradient * L_active, falling back to the element length, Bmad's gradient being a dependent attribute.

Tests added for all three; the translation guide documents them.

🤖 Generated with Claude Code

- e1_rect/e2_rect become Bmad's sector e1/e2, adding the share of the bend
  angle ref_geometry gives that face; e1 and e2_rect may now be mixed.
- angle_ref becomes Bmad's angle; it was dropped.
- An RF gradient becomes voltage = gradient * L_active (or length), read
  from the element's length rather than a nonexistent L.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation preview for this PR: https://pals-project.github.io/PALSParserPy/previews/PR3/

Rebuilt on every push; removed automatically when the PR closes.

@DavidSagan
DavidSagan merged commit 7e845ea into main Oct 17, 2026
5 checks passed
@DavidSagan
DavidSagan deleted the translator-fixes branch October 17, 2026 04:08
github-actions Bot added a commit that referenced this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant