-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
- It seems that all
Simulator/ControlSystemmethodsget_all_XXX, which I think are based on theElementHolderclass, returns a list and not arrays.
A small example based on SOLEIL II example notebook:
control_mode = sr.design
bpms = control_mode.get_all_bpms()
type(bpms) # returns list
bpms = control_mode.get_bpms("BPM")
type(bpms) # returns pyaml.arrays.bpm_array.BPMArray
From what I see, this is the case for all these methods, which prevent using the nice feature of the arrays.
- The methods of the
ElementHolderclass have no docstrings, but they are the ones exposed to the user here.
control_mode.get_bpms?
Signature: control_mode.get_bpms(name: str) -> pyaml.arrays.bpm_array.BPMArray
Docstring: <no docstring>
File: ~/Python_dev/pyaml/pyaml/pyaml/common/element_holder.py
Type: method
- More of a comment/question: maybe this is me not knowing how to use pyAML but I was thinking that string-matching was implemented at the array level, is it? I was expecting the following code to work:
bpms = control_mode.get_element("BPM*")
---------------------------------------------------------------------------
PyAMLException Traceback (most recent call last)
Cell In[74], line 1
----> 1 bpms = control_mode.get_element("BPM*")
File [~/Python_dev/pyaml/pyaml/pyaml/common/element_holder.py:109](http://localhost:8889/home/gamelina/Python_dev/pyaml/pyaml/pyaml/common/element_holder.py#line=108), in ElementHolder.get_element(self, name)
108 def get_element(self, name: str) -> Element:
--> 109 return self.__get("Element", name, self.__ALL)
File [~/Python_dev/pyaml/pyaml/pyaml/common/element_holder.py:95](http://localhost:8889/home/gamelina/Python_dev/pyaml/pyaml/pyaml/common/element_holder.py#line=94), in ElementHolder.__get(self, what, name, array)
93 def __get(self, what, name, array) -> Element:
94 if name not in array:
---> 95 raise PyAMLException(f"{what} {name} not defined")
96 return array[name]
PyAMLException: Element BPM* not defined
Originally posted by @GamelinAl in #195 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels