Skip to content

Elementholder api refurbishment - #430

Draft
gupichon wants to merge 14 commits into
mainfrom
199-elementholder-api-refurbishment
Draft

gupichon wants to merge 14 commits into
mainfrom
199-elementholder-api-refurbishment

Conversation

@gupichon

@gupichon gupichon commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Description

Integration PR for epic #199, ElementHolder API refurbishment. Aggregates the sub-features that split the historically monolithic ElementHolder into typed sub-holders (.magnet(s), .bpm(s), .rf, .diagnostic, .tool, ...) reachable through Python properties, with typed get() and array access instead of the old untyped get_all*() and get_*s() list-returning methods.

This branch is merged incrementally as each sub-issue lands, rather than opened as a single large PR, to keep review scoped per sub-feature.

Related Issue

Sub-issues and their status on this branch:

Changes to existing functionality

Testing

No tests added directly on this integration branch, each sub-issue's PR carries its own tests, see #426 for #373's tests/common/test_array_holder_navigation.py, and #375's PR for tests/tuning_tools/test_tool_accessors.py.

Verify that your checklist complies with the project

  • New and existing unit tests pass locally
  • Tests were added to prove that all features and changes are effective, covered per sub-PR
  • The code is commented where appropriate, covered per sub-PR
  • Any existing features are not broken

@gupichon gupichon self-assigned this Sep 17, 2026
@gupichon gupichon linked an issue Sep 17, 2026 that may be closed by this pull request
JeanLucPons
JeanLucPons previously approved these changes Sep 17, 2026
@JeanLucPons

Copy link
Copy Markdown
Member

If bpm(s) moves to diagnostic holder, bpm.py should ne moved in diagnostics directory.
and empy bpm folder removed.

@gupichon

Copy link
Copy Markdown
Member Author

If bpm(s) moves to diagnostic holder, bpm.py should ne moved in diagnostics directory. and empy bpm folder removed.

Yes, but @gubaidulinvadim suggested doing it later in another PR. Would you prefer to do it in this one? Personally, I don't mind.

@gupichon

Copy link
Copy Markdown
Member Author

Everything has been merged here. I will rebase this afternoon and request a review.

@JeanLucPons, @TeresiaOlsson, @GamelinAl, @simoneliuzzo, @kparasch, @gubaidulinvadim and anyone else: feel free to start reviewing right now, as things won't change much after the rebase.

Comment thread pyaml/common/holders/tool_holder.py Outdated
from ...tuning_tools.tune import Tune

name = "DEFAULT_TUNE_CORRECTION"
return self._validate_type(name, self._peer.get_tune_tuning(name), Tune)

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.

Very minor comment. Could we simplify with:

return self._validate_type(name, self.get(name), Tune)

?

Comment thread pyaml/common/holders/element_holder.py Outdated
and ``tool.dispersion``.
trm, crm, orm
Response-matrix measurement tools, looked up by name.
Backward-compatible aliases for ``tool.trm``, ``tool.crm`` and ``tool.orm``.

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.

I tend to prefer breaking backward-compatibility this early in development.

If we say that sr.live.tool.orm is the preferred way to access the orm tool, we should enforce it.

@kparasch kparasch left a comment

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.

Looks ok to me, some minor comments only

@gupichon
gupichon force-pushed the 199-elementholder-api-refurbishment branch from 6b654e1 to db35db7 Compare September 28, 2026 14:11

@GamelinAl GamelinAl left a comment

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.

Two issues:

  1. Compared to #199 we still miss the support of ElementHolder get method for named arrays: sr.live.get("CELL08"). Only the old syntax sr.live.get_elements("CELL08") is working.
  2. We should also clean the API, I would say we can remove:
    • get_element
    • get_elements
    • get_all_elements
    • get_*_tuning
    • get_betatron_tune_monitor

After this it should be good I think.

…older-api-refurbishment-review

Remove ElementHolder backward-compatible tool aliases (PR #430 review)

This branch has not been deployed

No deployments
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.

ElementHolder API refurbishment

5 participants