Skip to content

Updated CS example#287

Merged
gupichon merged 1 commit into
mainfrom
update-cs-example
Jun 15, 2026
Merged

Updated CS example#287
gupichon merged 1 commit into
mainfrom
update-cs-example

Conversation

@JeanLucPons

Copy link
Copy Markdown
Contributor

This PR update example/ControlSystem/tango.

It shows how a BPM or DeviceAccess can be accessed.
It is similar here to a dynamic catalog in pyaml-cs-oa or tango-pyaml.

from pyaml.accelerator import Accelerator

sr = Accelerator.load("config.yaml")

# print the BPM position
bpm = sr.live.get_bpm("BPM_C01-01") # bpm is a BPM
print(bpm.positions.get())

# Direct access to control system
da = sr.live.get_device("srdiag/bpm/c01-01/SA_HPosition") # da is a DeviceAccess
print(f"h={da.get()} {da.unit()}")
[ubuntu20acu.pons] > python main.py 
[-1.05921952e-05  3.91472705e-06]
h=-1.0592195175840235e-05 m

@TeresiaOlsson

Copy link
Copy Markdown
Contributor

I find that maybe the name get_device is a bit confusing because many users think device == element. Maybe it can be called get_deviceaccess to make it clearer what it is you will get or you think that name is too long?

@JeanLucPons

Copy link
Copy Markdown
Contributor Author

ok we can rename to get_device_access().
@gupichon-soleil what do you think ?
It will impact backends.

@gupichon

Copy link
Copy Markdown
Contributor

Yes, get_device_access() is ok. The change is minor.

@gupichon gupichon merged commit 0b27561 into main Jun 15, 2026
3 checks passed
@gubaidulinvadim gubaidulinvadim deleted the update-cs-example branch June 15, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants