The MagnetArray class needs to improved, it probably should inherit from a more generic class ElementArray which handles all kind of pyAML elements (BPMs, RF cavities, ...).
Most the features we need are detailed in section 2.3 of the User Interface Specification but I recall a few here:
I propose the following behavior for arrays (which I think match the User Interface Specification document):
- The array is composed of different types of pyAML elements, then it's a
ElementArray and there is no access at the array level to the individual element specific properties (magnet strength, BPM reading, ...), only to the common properties (name, hardware_name, ...).
- The array is composed of the same pyAML type, then there is an array level access to the individual element specific properties.
- Specific case of
CombinedFunctionMagnet. If an array is composed of Sextupole and CombinedFunctionMagnet with a sextupolar component, then the sextupolar strength is accessible at the array level.
- 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'.
- Support heterogeneous
MagnetArray (different magnet types).
- Implement element access by:
hardware_name or list of hardware_name (with wildcard type regex possible)
name or list of name (with wildcard type regex possible)
- Element type filtering
- a boolean array of
len(ElementArray)
- Implement element wise boolean operators
- For example the & operator should return the intersection of two arrays:
bpm_cell8 = sr.cell8 & sr.bpm # return an ElementArray with the common element between the two arrays sr.cell8 and sr.bpm.
The
MagnetArrayclass needs to improved, it probably should inherit from a more generic classElementArraywhich handles all kind of pyAML elements (BPMs, RF cavities, ...).Most the features we need are detailed in section 2.3 of the User Interface Specification but I recall a few here:
I propose the following behavior for arrays (which I think match the User Interface Specification document):
ElementArrayand there is no access at the array level to the individual element specific properties (magnet strength, BPM reading, ...), only to the common properties (name,hardware_name, ...).CombinedFunctionMagnet. If an array is composed ofSextupoleandCombinedFunctionMagnetwith a sextupolar component, then the sextupolar strength is accessible at the array level.qcorr[0:5]) should return aMagnetArray, not alist.qcorr[0:5].strengths→AttributeError: 'list' object has no attribute 'strengths'.MagnetArray(different magnet types).hardware_nameor list ofhardware_name(with wildcard type regex possible)nameor list ofname(with wildcard type regex possible)len(ElementArray)bpm_cell8 = sr.cell8 & sr.bpm # return an ElementArray with the common element between the two arrays sr.cell8 and sr.bpm.