Context
Thanks to the work of @Pichon, I was able to test the current pyaml version on the SOLEIL II digital twin (based on a modified version of the ESRF-EBS simulator).
Here is some user feedback on the current implementation, I propose to discuss it and them to split it in subtasks when we agree on some changes.
For this feedback, I focused on the most basic features of pyAML but I was also able to run the tune response matrix example of @JeanLucPons adapted to the SOLEIL II lattice. I think that with a few modifications to the actual code base, we will not be too far from a version in which we will be able to implement the chosen use cases.
General Comments
- Coding Style:
- The codebase uses many
get/set functions, which feels un-Pythonic. Consider using properties with getters/setters for a smoother user experience.
- Internal vs. User-facing Methods:
- Clearly distinguish between methods intended for users and internal ones.
- Internal methods should be prefixed with
_ or __ to hide them from introspection (e.g., in IPython/terminal).
- Function Naming:
- The function
pyaml (used to load .yaml configurations) should have a descriptive name, e.g., load_pymal_config.
Specific Feedback
pyaml.lattice.simulator.Simulator / pyaml.controlsystem.TangoControlSystem
get_all_magnets Method:
- Currently returns a
dict, but should return an array to enable filtering/sorting.
- Question: Should this be a property instead of a method?
- Feature Request:
- Add a property/method to retrieve all elements (magnets, BPMs, devices, etc.), not just magnets.
pyaml.lattice.magnet
__repr__ Method:
- Should include the
control_mode (e.g., simulated vs. live) to avoid confusion.
__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', ...)
hardware_name Accessibility:
- Should be accessible as a property (at least in "live" mode).
- Current Workaround:
quad.model.get_devices()[0].name() # Returns 'AN14-AR/EM/OH.03-CQLN.13/strength'
- Control System Layer Access:
- Should provide easy access to the Python control system layer (e.g.,
pyTango/pyEPICS).
- For Tango, suggest adding a
device_proxy attribute to return the TangoDeviceProxy for the element.
pyaml.arrays.magnet_arrays.MagnetArray
- Subset Handling:
- Subsets (e.g.,
qcorr[0:5]) should return a MagnetArray, not a list.
- Bug:
qcorr[0:5].strengths → AttributeError: 'list' object has no attribute 'strengths'.
- The
MagnetArray class is currently too simplistic and lacks key features for practical use.
- Support heterogeneous
MagnetArray (different magnet types).
- Implement element access by:
hardware_name
name
- Element type filtering
pyaml.control.abstract_impl.RWStrengthScalar
get Method:
- Currently returns an array instead of a
float.
- Example:
quad.strength.get() # Returns [0.0]
pyaml.arrays.magnet_array.RWMagnetStrength
- Setting Values:
- Should support setting RWArrays using a single value (not just arrays of the same shape).
- Bug:
sh1.strengths.set(1) → TypeError: 'float' object is not subscriptable
Context
Thanks to the work of @Pichon, I was able to test the current
pyamlversion on the SOLEIL II digital twin (based on a modified version of the ESRF-EBS simulator).Here is some user feedback on the current implementation, I propose to discuss it and them to split it in subtasks when we agree on some changes.
For this feedback, I focused on the most basic features of pyAML but I was also able to run the tune response matrix example of @JeanLucPons adapted to the SOLEIL II lattice. I think that with a few modifications to the actual code base, we will not be too far from a version in which we will be able to implement the chosen use cases.
be8b5d0e5f2e08f674c7072d3761fd6f6f77bef2pyamlcodebase.General Comments
get/setfunctions, which feels un-Pythonic. Consider using properties with getters/setters for a smoother user experience._or__to hide them from introspection (e.g., in IPython/terminal).pyaml(used to load.yamlconfigurations) should have a descriptive name, e.g.,load_pymal_config.Specific Feedback
pyaml.lattice.simulator.Simulator/pyaml.controlsystem.TangoControlSystemget_all_magnetsMethod:dict, but should return an array to enable filtering/sorting.pyaml.lattice.magnet__repr__Method:control_mode(e.g.,simulatedvs.live) to avoid confusion.__str__Method:hardware_nameAccessibility:pyTango/pyEPICS).device_proxyattribute to return theTangoDeviceProxyfor the element.pyaml.arrays.magnet_arrays.MagnetArrayqcorr[0:5]) should return aMagnetArray, not alist.qcorr[0:5].strengths→AttributeError: 'list' object has no attribute 'strengths'.MagnetArrayclass is currently too simplistic and lacks key features for practical use.MagnetArray(different magnet types).hardware_namenamepyaml.control.abstract_impl.RWStrengthScalargetMethod:float.pyaml.arrays.magnet_array.RWMagnetStrengthsh1.strengths.set(1)→TypeError: 'float' object is not subscriptable