PyAML device identification (name uniqueness?) #26
|
Hello, There were already several discussions around the way to identity a device in PyAML and in pyAT. The limitation is that, at the configuration level, the type has to be specified for array definitions. type: pyaml.arrays.hcorrector # Can contains only HCorrector
name: HCORR
elements:
- SH1A-C01-H
- SH1A-C02-H
type: pyaml.arrays.element
name: ARBITRARY
elements:
- HCorrector(SH1A-C01-H)
- BPM(BPM-C01-2)
- RFCavity(CAV6)There are of course alternatives to make PyAML device names unique. Sum up (can change):
|
Replies: 5 comments 23 replies
|
I think there should be an unique name. In MML there are three different ways (family, element), (family, [cell, element]) and common name (including utility functions to translate between them). For the first two you always need to specify two things. It's annoying and at HZB we therefore use the common name which is an unique identifier since we have a naming convention which supports that. But at least the (family, [cell, element]) convention I think will also be required since many labs currently use that and only knows their devices by that naming convention. In MML the names between the MML "devices" and the lattice are completely separate. At the point where you want to add a simulator to your configuration, there is a special part to set up the mapping that you need to configure. I think that is a more flexible approach than relying on pyAML devices having the same name as in the lattice file but maybe there could be some default behaviour for those who are lucky and have the situation where the naming is the same. |
|
From a user's point of view, I think it would be much more convenient to not have to know the type to access a magnet, especially if we start having external types, e.g. complicated sextupoles/id devices. This would imply that the pyaml name is unique. I am ok if we end up deciding that the unique id is DESY lattices:
I think we should be able to specify the attribute ( |
|
One option for the mapping is to not add any automatic part but instead make the user implement this themselves. Potentially following the CATAP idea where It is a bit annoying and means more work when configuring the simulator but it also gives full flexibility. So pros/cons :/ |
|
An other proposal could be also to define an additional structured python attribute for an AT element.
|
|
Unique names could be a requirement for pyAML. In any case we need to do it at some point in any facility. Also a yaml file listing the UniqueNames would work for me: Every line is a lattice element; A line with multiple unique names is a CFM magnet. |
Custom element linker will be used to associate a PyAML name (or other field, if i correctly understood the implementation proposed by @gupichon) to a set of lattice elements.