accml_lib.custom.pyat_simulator package
Subpackages
Submodules
accml_lib.custom.pyat_simulator.accelerator_simulator module
- class accml_lib.custom.pyat_simulator.accelerator_simulator.PyATAcceleratorSimulator(*, at_lattice)[source]
Bases:
AcceleratorSimulatorInterfaceFactory class for creating proxies for accelerator elements.
This class provides an interface for retrieving accelerator element proxies from a given lattice structure.
Warning
Currently, this implementation uses an at_lattice directly, which should be revised when a proper lattice model becomes available.
Todo
Revisit name: still a proxy? The element proxy currently not necessary`?
Leave addon element proxy e.g. for handling combined function magnets
- get(element_id)[source]
Retrieve an element proxy based on the given element ID.
- Parameters:
element_id (str) – The ID of the element to retrieve.
- Returns:
The proxy object for the requested element.
- Return type:
- Raises:
ValueError – If the element is not found in the lattice.
- static get_element_id_of_host(element_id)[source]
Derives the host element ID from the provided element ID.
- Parameters:
element_id (str) – The ID of the element.
- Returns:
The ID of the host element.
- Return type:
- Raises:
ValueError – If the element ID cannot be processed.
- instantiate_addon_proxy(sub_lattice, *, element_id, host_element_id)[source]
Instantiates the correct proxy for the given sub lattice and element ID.
- Parameters:
sub_lattice – The AT sub lattice containing the element.
element_id – The ID of the element.
host_element_id – The ID of the host element.
- Returns:
The proxy instance for the element.
- Return type:
- Raises:
ValueError – If the element ID type is unsupported.
accml_lib.custom.pyat_simulator.element_proxies module
- class accml_lib.custom.pyat_simulator.element_proxies.AddOnElementProxy(obj, *, element_id, host_element_id)[source]
Bases:
ElementProxyProxy for an element whose updates are relayed to another element.
- host_element_id
ID of the host element.
- update(property_id, value, element_data)[source]
Update element properties dynamically based on property_id.
- Parameters:
property_id (
str) – The property to update.value – The value to set.
element_data – Element-specific data required for update.
- Raises:
ValueError – If an unknown property is specified.
- Todo: is that Liaison management?
the inverse way
- class accml_lib.custom.pyat_simulator.element_proxies.ElementProxy(obj, *, element_id, name=None)[source]
Bases:
ElementInterfaceProxy class for an accelerator element to handle interactions and updates.
- _obj
The underlying accelerator element.
- element_id
Identifier for the element.
- on_update_finished
Event triggered upon update completion.
- on_changed_value
Event triggered upon value change.
- async update(property_id, value)[source]
Update element properties dynamically based on property_id.
- Parameters:
- Raises:
ValueError – If an unknown property is specified.
- Todo: is that Liaison management?
the inverse way
- async update_shift(*, dx=None, dy=None)[source]
Update the element shift.
- Parameters:
dx – Shift in x-direction.
dy – Shift in y-direction.
- Raises:
AssertionError – If both dx and dy are None.
- class accml_lib.custom.pyat_simulator.element_proxies.KickAngleCorrectorProxy(obj, *, correction_plane, **kwargs)[source]
Bases:
AddOnElementProxyProxy for handling kick angle corrections in a specific plane.
- correction_plane
Specifies whether correction is horizontal or vertical.
- async update(property_id, value, element_data)[source]
Handle updates for the corrector element.
- Parameters:
property_id (
str) – The property to update (should be ‘im’).value – The value to set.
element_data – Element-specific conversion data.
- Raises:
ValueError – If an unknown property is specified.
- accml_lib.custom.pyat_simulator.element_proxies.estimate_shift(element, eps=1e-08)[source]
Todo: get it upstreamed into pyat todo: currently this is very pyat specific element update Estimate the shift values for an element.
- Parameters:
element – The element to estimate shift for.
eps – Tolerance value for consistency check.
- Returns:
Computed shift values.
- Return type:
np.ndarray
- Raises:
AssertionError – If standard deviation exceeds the tolerance.
accml_lib.custom.pyat_simulator.simulator_backend module
- class accml_lib.custom.pyat_simulator.simulator_backend.SimulationStateModel[source]
Bases:
objectall methods added by class::transitions.Machine
transititions used as bluesky seems not to use superstate machine any more
- class accml_lib.custom.pyat_simulator.simulator_backend.SimulatorBackend(*, acc, name, logger=<RootLogger root (WARNING)>)[source]
Bases:
BackendRWSimulation backend based on pyAT
I assume today that the calculation engine works the following way:
set to a state
then calculations are triggered
So the calculations shall only happen after the state was set (completely).This is not (and can not) directly observed here. Here the calculation is only conducted when its results are requested. Calculation, setting, and reading back calculation results are protected by a lock, so no more sets are made while calculation is running nor calculation results are delivered ahead of time.
Todo
where to break async / sync or threaded approach?
- Parameters:
name (str)
Module contents
Accelerator backend based on pyat