Skip to content

BPMArray is not linked correctly with simulator #80

@kparasch

Description

@kparasch

I tried to read the orbit from the BPMArray (called 'BPM') using the EBSOrbit.yaml configuration. It works using sr.live but not when using sr.design getting the error below. I haven't tried yet to look more what is the exact issue, but maybe someone more familiar knows already what is the issue or if I am doing something wrong.

This is a minimal script to reproduce it:

from pyaml.accelerator import Accelerator

config_path('pyaml/tests/config/EBSOrbit.yaml') # replace accordingly
sr = Accelerator.load(config_path)

sr.live.get_bpms('BPM').h.get() # ok
sr.design.get_bpms('BPM').h.get() #throws error
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~/workspace/010_pyaml/pyaml/examples/ESRF_ORM_example/esrf_orm_example.py:12
      9 sr = Accelerator.load(config_path)
     11 sr.live.get_bpms('BPM').h.get() # ok
---> 12 sr.design.get_bpms('BPM').h.get()
     14  # class ConfigModel(BaseModel):
     15  # 
     16  #     model_config = ConfigDict(arbitrary_types_allowed=True,extra="forbid")
   (...)
     35  # 
     36  # interface = pySCInterface(ConfigModel(element_holder=sr.design))

File ~/workspace/010_pyaml/pyaml/pyaml/arrays/bpm_array.py:44, in RWBPMSinglePosition.get(self)
     42     return np.array([b.positions.get()[self.__idx] for b in self.__bpms])
     43 else:
---> 44     return self.__aggregator.get()

File ~/workspace/010_pyaml/pyaml/pyaml/lattice/abstract_impl.py:202, in BPMHScalarAggregator.get(self)
    201 def get(self) -> np.array:
--> 202     _, orbit = at.find_orbit(self.__lattice, refpts=self.__refpts)
    203     return orbit[:, 2]

AttributeError: 'BPMHScalarAggregator' object has no attribute '_BPMHScalarAggregator__lattice'

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions