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 FamName behavior 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
Originally posted by @gupichon in python-accelerator-middle-layer/governance#10 (comment)
Summary
The current link between PyAT lattice elements and PyAML elements relies on the
FamNamefield.This mechanism is limited and often leads to awkward workarounds — for example, in
RWHardwareScalarandRWStrengthScalar, which retrieve a list of elements byFamNamebut 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:
The chosen linking module (including possible custom implementations defined outside
pyaml) would be declared in thesimulatorsection of the YAML configuration.Benefits
Tasks
FamNameLinker(current behavior)IndexLinker,AttributeLinker, …)simulator.linkerRWHardwareScalar,RWStrengthScalar, etc.)Originally posted by @gupichon in python-accelerator-middle-layer/governance#10 (comment)