-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Summary
The current link between PyAT lattice elements and PyAML elements relies on the FamName field.
This mechanism is limited and often leads to awkward workarounds — for example, in RWHardwareScalar and RWStrengthScalar, which retrieve a list of elements by FamName but end up using only the first one.
Proposal
Introduce a modular linking system to define how PyAT elements are matched with PyAML elements.
-
The linking logic would be handled by dedicated modules.
-
A default module would keep the current
FamNamebehavior for backward compatibility. -
Other strategies could include:
- Linking by PyAT element index,
- Linking by a user-defined attribute (e.g., a custom property in the lattice).
The chosen linking module (including possible custom implementations defined outside pyaml) would be declared in the simulator section of the YAML configuration.
Benefits
- Improved flexibility for different naming conventions and lattice structures
- Cleaner and more consistent code in element access classes
- Easier integration with custom or external mapping logic
Tasks
- Define a base interface for linking modules
- Implement a default
FamNameLinker(current behavior) - Implement alternative linkers (
IndexLinker,AttributeLinker, …) - Add configuration entry under
simulator.linker - Update existing components (
RWHardwareScalar,RWStrengthScalar, etc.) - Write documentation and examples
Originally posted by @gupichon in python-accelerator-middle-layer/governance#10 (comment)