Skip to content

Commit ebc69a1

Browse files
committed
Add load function to instrument class.
1 parent cde0256 commit ebc69a1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

examples/ESRF_tune_example/esrf_tune_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Normalize the path (resolves '..')
1414
absolute_path = os.path.abspath(relative_path)
1515

16-
sr:Instrument = load_instrument(absolute_path)
16+
sr:Instrument = Instrument.load(absolute_path)
1717
sr.design.get_lattice().disable_6d()
1818

1919
quadForTuneDesign = sr.design.get_magnets("QForTune")

pyaml/instrument.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .lattice.simulator import Simulator
88
from .arrays.array import ArrayConfig
99
from pydantic import BaseModel,ConfigDict
10+
from .configuration import load_instrument
1011

1112
# Define the main class name for this module
1213
PYAMLCLASS = "Instrument"
@@ -85,3 +86,7 @@ def live(self) -> ControlSystem:
8586
@property
8687
def design(self) -> Simulator:
8788
return self.__design
89+
90+
@staticmethod
91+
def load(filename:str) -> "Instrument":
92+
return load_instrument(filename)

0 commit comments

Comments
 (0)