Skip to content

String representation of pyAML objects #42

@GamelinAl

Description

@GamelinAl

We need proper string representations for pyAML objects, implementing both __repr__ and __str__ methods.

Here is some proposal for key elements:

For example for pyaml.lattice.magnet

  1. __repr__ Method:
    • Should include both the name and the control_mode (e.g., simulated vs. live) to avoid confusion.
  2. __str__ Method:
    • Should print detailed information about the magnet, e.g.:
      Sextupole(name='SXF2', strength=809.008, currents=[140,...], hardware_name='AN01-AR/EM/SCF.02', control_mode='live', ...)

For pyaml.instrument.Instrument

  1. __repr__ Method:
    • Should include the instrument name (given in the configuration).
  2. __str__ Method:
    • Should include the instrument name (given in the configuration) and the name of the configuration file read (if any).

For tango.pyaml.controlsystem

  1. __repr__ Method:
    • Should include the instrument name and the control system type.
  2. __str__ Method:
    • Should include all of the above plus tango_host (for tango.pyaml.controlsystem.TangoControlSystem).

For pyaml.lattice.simulator.Simulator

  1. __repr__ Method:
    • Should include the instrument name, the control system type.
  2. __str__ Method:
    • Should include all of the above plus the lattice name and energy.

For RWStrengthScalar and similar classes

  1. __repr__ Method:
    • Should include the linked property name (corresponding to model.get_devices()[0].name()) and unit.

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