Skip to content

Modular linking between PyAT and PyAML elements #30

@gupichon

Description

@gupichon

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

  • 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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions