Skip to content

PALS Python 0.3.0, Unit Convention for Quad#1357

Open
cemitch99 wants to merge 7 commits into
BLAST-ImpactX:developmentfrom
cemitch99:update_pals_support
Open

PALS Python 0.3.0, Unit Convention for Quad#1357
cemitch99 wants to merge 7 commits into
BLAST-ImpactX:developmentfrom
cemitch99:update_pals_support

Conversation

@cemitch99
Copy link
Copy Markdown
Member

@cemitch99 cemitch99 commented Mar 18, 2026

Update PALS-Python from 0.2.0 to 0.3.0

  • bump dependency to 0.3.0
  • and upgrade the breaking changes

Fix unit convention for PALS Quad support

PALS support requires additional implementation of translation on the ImpactX side.

For the PALS Quad, the option of specifying gradient in two unit systems, as Bn1 or Kn1, needs to be supported. This PR fixes the existing choice of units.

@cemitch99 cemitch99 requested a review from ax3l March 18, 2026 19:05
@ax3l ax3l added bug Something isn't working bug: affects latest release Bug also exists in latest release version component: python Python bindings labels Mar 18, 2026
@ax3l ax3l self-assigned this Mar 18, 2026
@ax3l
Copy link
Copy Markdown
Member

ax3l commented Mar 18, 2026

Oh, probably needs to update the analysis in fodo-pals.py now (examples/pals/analysis_fodo_pals.py)

@ax3l ax3l mentioned this pull request Mar 18, 2026
4 tasks
@cemitch99
Copy link
Copy Markdown
Member Author

@ax3l In the ImpactX parsing lines, we just need to check whether PALS input Bn1 or Kn1 is provided and branch accordingly.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 37 untouched benchmarks


Comparing cemitch99:update_pals_support (f1309b9) with development (ac4fe71)

Open in CodSpeed

@ax3l ax3l force-pushed the development branch 2 times, most recently from 9a1e4af to fa61eba Compare April 20, 2026 04:08
@ax3l ax3l changed the title Fix unit convention for PALS Quad support. PALS Python 0.2.0, Unit Convention for Quad May 6, 2026
@ax3l ax3l changed the title PALS Python 0.2.0, Unit Convention for Quad PALS Python 0.3.0, Unit Convention for Quad May 6, 2026
ax3l added 3 commits May 6, 2026 11:25
Update dependencies, not yet API changes.
New schema used in PALS.
- flatten PALS structure
- address beaking API change in multipole/quad
@ax3l ax3l requested a review from EZoni May 6, 2026 19:24
Comment on lines +194 to +211
def flatten_pals(pals_data, registry=None):
"""Flatten a PALS root, lattice, or beamline to a list of PALS elements.

Placeholder references are resolved from the root facility definitions.
"""
from pals import BeamLine, Lattice, PALSroot, PlaceholderName

if registry is None:
registry = {}

if isinstance(pals_data, PALSroot):
registry = {
item.name: item
for item in pals_data.facility
if not isinstance(item, PlaceholderName) and hasattr(item, "name")
}

if len(pals_data.facility) == 1:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flatten_pals and the inner details of from_pals deserve to go into their own src/python/impactx/pals_to_impactx.py file, but maybe as a follow-up PR.

)


def flatten_pals(pals_data, registry=None):
Copy link
Copy Markdown
Member

@ax3l ax3l May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flatten_pals could be a helper routine in pals-python, for the next release of it.

I am surprised that we still have placeholders at this point in the logic, we probably should replace placeholders / do lattice expansion already in pals.load() -- to check if as an optional argument (i.e. lattice_expansion=True). To check lattice and branch expansion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the next release (not this PR): pals-project/pals-python#70

@cemitch99

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug: affects latest release Bug also exists in latest release version bug Something isn't working component: python Python bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants