atip.sim_data_sources
#
Module containing the pytac data sources for the AT simulator.
Members
A simulator data source to enable AT elements to be addressed using the standard Pytac syntax. |
|
A simulator data source to allow the physics data of the AT lattice to be addressed using the standard Pytac syntax. |
- class atip.sim_data_sources.ATElementDataSource(at_element, index, atsim, fields=None)[source]#
A simulator data source to enable AT elements to be addressed using the standard Pytac syntax.
Attributes
Note
This data source, currently, cannot understand the simulated equivalent of shared devices on the live machine, or multiple devices that address the same field/attribute for that matter.
- Parameters:
at_element (at.elements.Element) – The AT element corresponding to the Pytac element which this data source is attached to.
index (int) – The element’s index in the ring, starting from 1.
atsim (ATSimulator) – An instance of an ATSimulator object.
- Raises:
ValueError – if an unsupported field is passed, i.e. a field not in _field_funcs.keys().
Methods:
- get_fields()[source]#
Get all the fields that are defined for the data source on this element.
- Returns:
A list of all the fields that are present on this element.
- Return type:
- add_field(field)[source]#
Add a field to this data source. This is normally done automatically when adding a device, however since the simulated data sources do not use devices this method is needed.
- Parameters:
field (str) – The name of a supported field that is not already on this data_source.
- Raises:
pytac.FieldException – if the specified field is already present or if it is not supported.
- get_value(field, handle=None, throw=True)[source]#
Get the value for a field.
- Parameters:
field (str) – The requested field.
handle (str, Optional) – Handle is not needed and is only here to conform with the structure of the DataSource base class.
throw (bool, Optional) – If the check for completion of outstanding calculations times out, then: if True, raise a ControlSystemException; if False, log a warning and return the potentially out of date data anyway.
- Returns:
The value of the specified field on this data source.
- Return type:
- Raises:
pytac.FieldException – if the specified field does not exist.
pytac.ControlSystemException – if the calculation completion check fails, and throw is True.
- set_value(field, value, throw=None)[source]#
Set the value for a field. The field and value go onto the queue of changes on the ATSimulator to be passed to make_change when the queue is emptied.
- Parameters:
- Raises:
pytac.HandleException – if the specified field cannot be set to.
pytac.FieldException – if the specified field does not exist.
- class atip.sim_data_sources.ATLatticeDataSource(atsim)[source]#
A simulator data source to allow the physics data of the AT lattice to be addressed using the standard Pytac syntax.
Attributes
Note
Though not currently supported, there are plans to add get_element_values and set_element_values methods to this data source in future.
- Parameters:
atsim (ATSimulator) – An instance of an ATSimulator object.
Methods:
- get_fields()[source]#
Get all the fields that are defined for this data source on the Pytac lattice.
- Returns:
A list of all the fields that are present on this element.
- Return type:
- get_value(field, handle=None, throw=True)[source]#
Get the value for a field on the Pytac lattice.
- Parameters:
field (str) – The requested field.
handle (str, Optional) – Handle is not needed and is only here to conform with the structure of the DataSource base class.
throw (bool, Optional) – If the check for completion of outstanding calculations times out, then: if True, raise a ControlSystemException; if False, log a warning and return the potentially out of date data anyway.
- Returns:
The value of the specified field on this data source.
- Return type:
- Raises:
pytac.FieldException – if the specified field does not exist.
pytac.ControlSystemException – if the calculation completion check fails, and throw is True.