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
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ def unit(self) -> str:

# Main code
sr = Accelerator.from_dict(acc_config)
tm1 = sr.live.get_betatron_tune_monitor("MY_TUNE_MONITOR")
tm1 = sr.live.diagnostic.get("MY_TUNE_MONITOR")
print(tm1.tune.get())
print(tm1.frequency.get())
2 changes: 1 addition & 1 deletion examples/use_cases/01-tune_correction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
}
],
"source": [
"tune_monitor = SR.get_betatron_tune_monitor(\"BETATRON_TUNE\")\n",
"tune_monitor = SR.diagnostic.get(\"BETATRON_TUNE\")\n",
"print(f\"Current tune: {tune_monitor.tune.get()}\")\n",
"tune_monitor # string representation"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/use_cases/01-tune_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# In[4]:


tune_monitor = SR.get_betatron_tune_monitor("BETATRON_TUNE")
tune_monitor = SR.diagnostic.get("BETATRON_TUNE")
print(f"Current tune: {tune_monitor.tune.get()}")
print(tune_monitor) # string representation

Expand Down
2 changes: 1 addition & 1 deletion examples/use_cases/02-chromaticity_measurement.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
}
],
"source": [
"chroma_monitor = SR.get_chromaticity_monitor(\"CHROMATICITY_MONITOR\")\n",
"chroma_monitor = SR.tool.get(\"CHROMATICITY_MONITOR\")\n",
"\n",
"chroma_monitor.measure(\n",
" callback=chroma_callback,\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/use_cases/02-chromaticity_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def chroma_callback(action: int, cb_data: dict):
# In[17]:


chroma_monitor = SR.get_chromaticity_monitor("CHROMATICITY_MONITOR")
chroma_monitor = SR.tool.get("CHROMATICITY_MONITOR")

chroma_monitor.measure(
callback=chroma_callback,
Expand Down
2 changes: 1 addition & 1 deletion pyaml/arrays/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def fill_array(self, holder: ElementHolder):
.. code-block:: python

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

Expand Down
4 changes: 2 additions & 2 deletions pyaml/arrays/element_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ElementArray(list[Element]):
.. code-block:: python

>>> sr = Accelerator.load("acc.yaml")
>>> elements = sr.design.get_elements("QuadForTune")
>>> elements = sr.design.get("QuadForTune")
"""

def __init__(self, array_name: str, elements: list[Element], use_aggregator=True):
Expand Down Expand Up @@ -282,7 +282,7 @@ def __and__(self, other: object):

.. code-block:: python

>>> cell1 = sr.live.get_elements("C01")
>>> cell1 = sr.live.get("C01")
>>> sexts = sr.live.get_magnets("SEXT")
>>> cell1_sext = cell1 & sexts

Expand Down
9 changes: 1 addition & 8 deletions pyaml/common/holders/diagnostic_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ class DiagnosticHolder:
get(name=None)
Return a named diagnostic, or all configured diagnostics when no name is given.

Notes
-----
:meth:`ElementHolder.get_betatron_tune_monitor
<pyaml.common.holders.element_holder.ElementHolder.get_betatron_tune_monitor>` stays
available as the named, untyped lookup. This holder adds the default-name,
type-validated convenience property.

Examples
--------
>>> default_tune_monitor = sr.live.diagnostic.betatron_tune
Expand Down Expand Up @@ -144,7 +137,7 @@ def betatron_tune(self) -> BetatronTuneMonitor:
:class:`~pyaml.diagnostics.tune_monitor.BetatronTuneMonitor`.
"""
name = "BETATRON_TUNE"
obj = self._peer.get_betatron_tune_monitor(name)
obj = self.get(name)
if not isinstance(obj, BetatronTuneMonitor):
raise PyAMLException(f"{name}: BetatronTuneMonitor expected but got {type(obj).__name__}")
return obj
Expand Down
Loading
Loading