Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions pyaml/apidoc/gen_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def generate_selective_module(m):
for c in all_cls:
file.write(f" .. autoclass:: {c.__name__}\n")
file.write(" :members:\n")
if m in ["pyaml.arrays.element_array"]:
# Include special members for operator overloading
file.write(
" :special-members: __add__, __and__, __or__, __sub__ \n"
)
file.write(" :exclude-members: model_config\n")
file.write(" :undoc-members:\n")
file.write(" :show-inheritance:\n\n")
Expand Down
31 changes: 22 additions & 9 deletions pyaml/arrays/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@


class ConfigModel(ArrayConfigModel):
"""Configuration model for Element array."""

...
"""Configuration model for :py:class:`.ElementArray`."""


class Element(ArrayConfig):
"""
Element array confirguration
:py:class:`.ElementArray` configuration.

Example
-------

An element array configuration can also be created by code using
the following example::
the following example:

.. code-block:: python

from pyaml.arrays.element import Element,ConfigModel as ElementArrayConfigModel
elemArray = Element(
ElementArrayConfigModel(name="MyArray", elements=["elt1","elt2"])
)
elt_cfg = Element(
ElementArrayConfigModel(name="MyArray", elements=["BPM_C04-01","SH1A-C04-H"])
)


"""
Expand All @@ -34,7 +34,20 @@ def __init__(self, cfg: ArrayConfigModel):

def fill_array(self, holder: ElementHolder):
"""
Fill the element array in the element holder.

Fill the :py:class:`.ElementArray` using element holder
(:py:class:`~pyaml.lattice.simulator.Simulator`
or :py:class:`~pyaml.control.controlsystem.ControlSystem`)
and add the array to the holder. This method is called when an
:py:class:`~pyaml.accelerator.Accelerator` is loaded but can be
used to create arrays by code as shown bellow:

.. code-block:: python

>>> elt_cfg.fill_array(sr.design)
>>> names = sr.design.get_elements("MyArray").names()
>>> print(names)
['BPM_C04-01', 'SH1A-C04-H']

Parameters
----------
Expand Down
Loading
Loading