Skip to content

Commit edfb26f

Browse files
authored
Merge pull request #191 from python-accelerator-middle-layer/soleil-examples
Updated SOLEIL examples.
2 parents 1b002f2 + bc3aa8d commit edfb26f

11 files changed

Lines changed: 19390 additions & 22455 deletions

examples/ESRF_ORM_example/correct_orbit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pyaml_folder = parent_folder.parent.parent
1111
config_path = pyaml_folder.joinpath("tests/config/EBSOrbit.yaml").resolve()
1212
sr = Accelerator.load(config_path)
13-
#ebs = sr.live
13+
# ebs = sr.live
1414
ebs = sr.design
1515

1616
## get reference

examples/SOLEIL_examples/01-SOLEIL_II_tune_example.ipynb

Lines changed: 381 additions & 463 deletions
Large diffs are not rendered by default.

examples/SOLEIL_examples/02-chromaticity_measurement.ipynb

Lines changed: 67 additions & 39 deletions
Large diffs are not rendered by default.

examples/SOLEIL_examples/03-Orbit_correction.ipynb

Lines changed: 809 additions & 0 deletions
Large diffs are not rendered by default.

examples/SOLEIL_examples/README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,63 @@
99
```bash
1010
pip install accelerator-middle-layer[tango-pyaml]
1111
```
12+
3. Alternatively, you can install ophyd-async Tango bindings
13+
```bash
14+
pip install accelerator-middle-layer[pyaml-cs-oa]
15+
```
1216

13-
## Start the SOLEIL II virtual accelerator
17+
If this does not work, you can proceed to do a developer installation directly from git repository.
18+
```bash
19+
# pyAML core
20+
git clone git@github.com:python-accelerator-middle-layer/pyaml.git
21+
cd pyaml
22+
pip install -e .[dev]
23+
# pyAML TANGO bindings
24+
git clone git@github.com:python-accelerator-middle-layer/tango-pyaml.git
25+
cd tango-pyaml
26+
pip install -e .
27+
#pyAML ophyd-async bindings (supports both TANGO and EPICS)
28+
git clone git@github.com:python-accelerator-middle-layer/pyaml-cs-oa.git
29+
cd pyaml-cs-oa
30+
pip install -e .
31+
```
32+
33+
You can verify that everything is installed correctly by running in Python or IPython terminal the start of the examples.
34+
35+
```python
36+
from pyaml.accelerator import Accelerator
37+
38+
sr = Accelerator.load("p.yaml")
39+
sr # string representation
40+
```
41+
42+
The following or a similar message will be printed
43+
```
44+
Accelerator(facility='Synchrotron SOLEIL', machine='sr', energy=2750000000.0, controls=[TangoControlSystem(name='live', tango_host='localhost:11000', debug_level=None, lazy_devices=True, scalar_aggregator='tango.pyaml.multi_attribute', vector_aggregator=None, timeout_ms=3000)], simulators=[Simulator(name='design', lattice='SOLEIL_II_V3631_sym1_V001_database_rf.m', mat_key=None, linker=<pyaml.lattice.attribute_linker.PyAtAttributeElementsLinker object at 0x7a1ce1e9deb0>, description=None)], data_folder='/data/store', description=None)
45+
```
46+
47+
pyAML has two control modes: "live" and "design" (named in the config file). "live" connects to a control system (or a control system emulator), "design" only requires pyAT lattice file and will run pyAT. If you want to avoid having any control system connection, you can delete "controls: " section from the configuration file.
48+
49+
### Start the SOLEIL II virtual accelerator
50+
51+
SOLEIL II virtual accelerator is an emulation of TANGO control system that runs pyAT under the hood.
1452
1553
1. Install [Apptainer](https://apptainer.org/docs/admin/main/installation.html) in case you don't already have it.
1654
17-
For the live control mode, you should have some control system emulation runing. It is possible to do
55+
For the live control mode, you should have some control system emulation running. It is possible to do
1856
```
19-
apptainer pull virtual-accelerator.sif oras://gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/apptainer/virtual-accelerator:latest
57+
apptainer pull -F virtual-accelerator.sif oras://gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/apptainer/virtual-accelerator:latest
2058
apptainer run virtual-accelerator.sif
2159
```
2260
23-
***Keep this terminal running and don't do anything else in it.*** The virtual accelerator will run there and you will be able to interact with it from other terminals, jupyter notebooks, IDEs etc over the network. If you want to put it in the background, using something like tmux would be a good option.
61+
***Keep this terminal running and don't do anything else in it.*** The virtual accelerator will run there, and you will be able to interact with it from other terminals, jupyter notebooks, IDEs, etc., over the network. If you want to put it in the background, using something like tmux would be a good option.
2462
25-
this will run SOLEIL II proof-of-concept digital twin on localhost:11000. You can play with the digital twin itself (without pyAML) via jive to check that everything is working. You can run jive in a different terminal with
63+
This will run SOLEIL II proof-of-concept digital twin on localhost:11000. You can play with the digital twin itself (without pyAML) via jive to check that everything is working. You can run Jive in a different terminal with
2664
```
27-
apptainer pull jive.sif https://gitlab.synchrotron-soleil.fr/api/v4/projects/2739/packages/generic/jive/latest/jive.sif
65+
apptainer pull -F jive.sif https://gitlab.synchrotron-soleil.fr/api/v4/projects/2739/packages/generic/jive/latest/jive.sif
2866
apptainer run jive.sif
2967
```
30-
On linux you may need additionally to configure X11
68+
On Linux you may need to configure X11 to display Jive
3169
```
3270
export DISPLAY=:0
3371
xhost +local:root
@@ -38,4 +76,4 @@ NOTE: This is just a demonstration of pyAML functionality. Certain things may be
3876
3977
## Run the examples
4078
41-
There are three jupyter notebook available with some basic examples. Feel free to play around and modify them. A .yaml configuration file is already provided, it was generated procedurally from the .m lattice file and nomenclature description file.
79+
There are three jupyter notebook available with some basic examples. Feel free to play around and modify them. The main configuration entry point is `p.yaml`; it now loads `arrays.yaml`, `devices.yaml`, and `tuning_tools.yaml`, all generated procedurally from the .m lattice file and nomenclature description file.

0 commit comments

Comments
 (0)