Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b557d1a
First catalog version with first reference in a test.
gupichon-soleil Feb 11, 2026
53689ce
Full example with BPMs
gupichon-soleil Feb 12, 2026
f1acf5f
Adding the possibility to customize the device suffixes for devices n…
gupichon-soleil Feb 12, 2026
ef9e55a
Merge remote-tracking branch 'origin/main' into 46-adding-catalogs-se…
gupichon-soleil Feb 12, 2026
c292bb4
No default names for BPM devices, possibilities to have several named…
gupichon-soleil Feb 12, 2026
58cd2e3
Adding a get_name method to the catalog for future use. Tests adaptat…
gupichon-soleil Feb 12, 2026
be7a1d7
Merge remote-tracking branch 'origin/main' into 46-adding-catalogs-se…
gupichon-soleil Feb 12, 2026
2a5a155
Moving the DeviceAccess retrieval to the control system.
gupichon-soleil Feb 13, 2026
348bdde
Nore more key building. Just use directly the key.
gupichon-soleil Feb 17, 2026
3ac3c2e
First catalog tests
gupichon-soleil Feb 18, 2026
26660c1
Merge remote-tracking branch 'origin/main' into 46-adding-catalogs-se…
gupichon-soleil Feb 18, 2026
c082d01
Adedd unit test for BPM aggregator
JeanLucPons Feb 18, 2026
03cfce5
Correction for indexed BPMs.
gupichon-soleil Feb 18, 2026
7c364b7
Ruff corrections
gupichon-soleil Feb 18, 2026
5435bc2
Suppression of the "positions" field. Using the x_pos and y_pos with …
gupichon-soleil Feb 19, 2026
4d752b7
Update of the soleil example configuration file
gupichon-soleil Feb 20, 2026
44a7d69
Managing the new field "catalog" for control systems.
gupichon-soleil Feb 20, 2026
74ddb76
Merge remote-tracking branch 'origin/main' into 46-adding-catalogs-se…
gupichon-soleil Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,993 changes: 2,531 additions & 1,462 deletions examples/SOLEIL_examples/p.yaml

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions pyaml/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .arrays.array import ArrayConfig
from .common.element import Element
from .common.exception import PyAMLConfigException
from .configuration.catalog import Catalog
from .configuration.factory import Factory
from .configuration.fileloader import load, set_root_folder
from .control.controlsystem import ControlSystem
Expand Down Expand Up @@ -44,6 +45,8 @@ class ConfigModel(BaseModel):
Acceleration description
devices : list[.common.element.Element]
Element list
control_system_catalog : Catalog
catalog of DeviceAccess objects
"""

model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
Expand All @@ -57,6 +60,7 @@ class ConfigModel(BaseModel):
description: str | None = None
arrays: list[ArrayConfig] = Field(default=None, repr=False)
devices: list[Element] = Field(repr=False)
control_system_catalogs: list[Catalog] = None


class Accelerator(object):
Expand All @@ -66,13 +70,20 @@ def __init__(self, cfg: ConfigModel):
self._cfg = cfg
__design = None
__live = None
self.__catalogs: dict[str, Catalog] = {}

if cfg.control_system_catalogs is not None:
for catalog in cfg.control_system_catalogs:
self.__catalogs[catalog.get_name()] = catalog

if cfg.controls is not None:
for c in cfg.controls:
if c.get_catalog_name():
c.set_catalog(self.__catalogs.get(c.get_catalog_name()))
if c.name() == "live":
self.__live = c
else:
# Add as dynacmic attribute
# Add as dynamic attribute
setattr(self, c.name(), c)
c.fill_device(cfg.devices)

Expand All @@ -81,7 +92,7 @@ def __init__(self, cfg: ConfigModel):
if s.name() == "design":
self.__design = s
else:
# Add as dynacmic attribute
# Add as dynamic attribute
setattr(self, s.name(), s)
s.fill_device(cfg.devices)

Expand Down
43 changes: 34 additions & 9 deletions pyaml/bpm/bpm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
from numpy.typing import NDArray

from ..configuration.catalog import Catalog
from ..control.deviceaccess import DeviceAccess


Expand All @@ -13,38 +14,62 @@ class BPMModel(metaclass=ABCMeta):
"""

@abstractmethod
def get_pos_devices(self) -> list[DeviceAccess | None]:
def get_x_pos_device(self) -> str | None:
"""
Get device handles used for position reading

Returns
-------
list[DeviceAccess]
h and v position devices
str | None
h position naming
"""
pass

@abstractmethod
def get_tilt_device(self) -> DeviceAccess | None:
def get_y_pos_device(self) -> str | None:
"""
Get device handles used for position reading

Returns
-------
str | None
v position naming
"""
pass

@abstractmethod
def get_tilt_device(self) -> str | None:
"""
Get device handle used for tilt access

Returns
-------
list[DeviceAccess]
tilt device
str | None
tilt naming
"""
pass

@abstractmethod
def get_x_offset_device(self) -> str | None:
"""
Get device handles used for offset access

Returns
-------
str | None
h offset naming
"""
pass

@abstractmethod
def get_offset_devices(self) -> list[DeviceAccess | None]:
def get_y_offset_device(self) -> str | None:
"""
Get device handles used for offset access

Returns
-------
list[DeviceAccess]
h and v offset devices
str | None
v offset naming
"""
pass

Expand Down
51 changes: 36 additions & 15 deletions pyaml/bpm/bpm_simple_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pyaml.bpm.bpm_model import BPMModel

from ..common.element import __pyaml_repr__
from ..configuration.catalog import Catalog
from ..control.deviceaccess import DeviceAccess

# Define the main class name for this module
Expand All @@ -31,10 +32,10 @@ class ConfigModel(BaseModel):

model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")

x_pos: DeviceAccess | None
y_pos: DeviceAccess | None
x_pos_index: int | None = None
y_pos_index: int | None = None
x_pos: str = None
y_pos: str = None


class BPMSimpleModel(BPMModel):
Expand All @@ -45,41 +46,61 @@ class BPMSimpleModel(BPMModel):

def __init__(self, cfg: ConfigModel):
self._cfg = cfg
self.__x_pos = cfg.x_pos
self.__y_pos = cfg.y_pos

def get_pos_devices(self) -> list[DeviceAccess | None]:
def get_x_pos_device(self) -> str | None:
"""
Get device handles used for position reading

Returns
-------
list[DeviceAccess]
Array of DeviceAcess
str | None
h position naming
"""
return [self.__x_pos, self.__y_pos]
return self._cfg.x_pos

def get_tilt_device(self) -> DeviceAccess | None:
def get_y_pos_device(self) -> str | None:
"""
Get device handles used for position reading

Returns
-------
str | None
v position naming
"""
return self._cfg.y_pos

def get_tilt_device(self) -> str | None:
"""
Get device handle used for tilt access

Returns
-------
list[DeviceAccess]
Array of DeviceAcess
str | None
tilt naming
"""
return None

def get_x_offset_device(self) -> str | None:
"""
Get device handles used for offset access

Returns
-------
str | None
h offset naming
"""
return None

def get_offset_devices(self) -> list[DeviceAccess | None]:
def get_y_offset_device(self) -> str | None:
"""
Get device handles used for offset access

Returns
-------
list[DeviceAccess]
Array of DeviceAcess
str | None
v offset naming
"""
return [None, None]
return None

def x_pos_index(self) -> int | None:
"""
Expand Down
60 changes: 26 additions & 34 deletions pyaml/bpm/bpm_tiltoffset_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pyaml.bpm.bpm_simple_model import BPMSimpleModel

from ..common.element import __pyaml_repr__
from ..configuration.catalog import Catalog
from ..control.deviceaccess import DeviceAccess

# Define the main class name for this module
Expand All @@ -20,27 +21,23 @@ class ConfigModel(BaseModel):

Parameters
----------
x_pos : DeviceAccess, optional
Horizontal position device
y_pos : DeviceAccess, optional
Vertical position device
x_offset : DeviceAccess, optional
Horizontal BPM offset device
y_offset : DeviceAccess, optional
Vertical BPM offset device
tilt : DeviceAccess, optional
BPM tilt device
x_pos_index : int, optional
Index in the array when specified, otherwise scalar
value is expected
y_pos_index : int, optional
Index in the array when specified, otherwise scalar
value is expected
"""

model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")

x_pos: DeviceAccess | None
y_pos: DeviceAccess | None
x_pos_index: int | None = None
y_pos_index: int | None = None
x_offset: DeviceAccess | None
y_offset: DeviceAccess | None
tilt: DeviceAccess | None
x_pos: str = None
y_pos: str = None
tilt: str = None
x_offset: str = None
y_offset: str = None


class BPMTiltOffsetModel(BPMSimpleModel):
Expand All @@ -51,44 +48,39 @@ class BPMTiltOffsetModel(BPMSimpleModel):

def __init__(self, cfg: ConfigModel):
super().__init__(cfg)
self.__x_pos = cfg.x_pos
self.__y_pos = cfg.y_pos
self.__x_offset = cfg.x_offset
self.__y_offset = cfg.y_offset
self.__tilt = cfg.tilt

def get_pos_devices(self) -> list[DeviceAccess | None]:
def get_tilt_device(self) -> str | None:
"""
Get device handles used for position reading
Get device handle used for tilt access

Returns
-------
list[DeviceAccess]
Array of DeviceAcess
str | None
tilt naming
"""
return [self.__x_pos, self.__y_pos]
return self._cfg.tilt

def get_tilt_device(self) -> DeviceAccess | None:
def get_x_offset_device(self) -> str | None:
"""
Get device handle used for tilt access
Get device handles used for offset access

Returns
-------
DeviceAccess
DeviceAcess
str | None
h offset naming
"""
return self.__tilt
return self._cfg.x_offset

def get_offset_devices(self) -> list[DeviceAccess | None]:
def get_y_offset_device(self) -> str | None:
"""
Get device handles used for offset access

Returns
-------
list[DeviceAccess]
Array of DeviceAcess
str | None
v offset naming
"""
return [self.__x_offset, self.__y_offset]
return self._cfg.y_offset

def __repr__(self):
return __pyaml_repr__(self)
2 changes: 1 addition & 1 deletion pyaml/common/element_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def fill_bpm_array(self, arrayName: str, elementNames: list[str]):
arrayName, elementNames, self.get_bpm, BPMArray, self.__BPM_ARRAYS
)

def get_bpm(self, name: str) -> Element:
def get_bpm(self, name: str) -> BPM:
return self.__get("BPM", name, self.__BPMS)

def add_bpm(self, bpm: BPM):
Expand Down
Loading