accml_lib.core.bl package

Submodules

accml_lib.core.bl.command_rewritter module

convert from lattice element change to device property

Please note:

here we have to map (lattice_name, property) -> (device_name, property)

class accml_lib.core.bl.command_rewritter.CommandRewriter(liaison_manager, translation_service)[source]

Bases: CommandRewriterBase

Command rewriter.

This module translates commands between two state spaces: from a lattice element specification to a device property specification (forward) and vice versa (inverse).

It uses a liaison manager to map identifiers and a translator service to convert the command values between representations.

Parameters:
forward(cmd)[source]
Return type:

Command

Parameters:

cmd (Command)

forward_read_command(command)[source]

Typically an answer of liaison manager

Return type:

ReadCommand

Parameters:

command (ReadCommand)

inverse(cmd)[source]

Convert a command from a device property space back to the lattice space.

:param : param cmd: The command to be transformed.

Return type:

Sequence[Command]

Returns:

A sequence of commands corresponding to the inverse translations.

Parameters:

cmd (Command)

inverse_read_command(command)[source]

Typically an answer of liaison manager

Return type:

Sequence[ReadCommand]

Parameters:

command (ReadCommand)

inverse_translate_one(cmd, dev_prop_id, lat_prop_id)[source]

Perform a single inverse translation.

:param : param dev_prop_id: The source device property identifier :param : param cmd: The original command :param : param lat_prop_id: The target lattice property identifier

Return type:

Command

Returns:

A new Command with the value converted to the lattice state.

Parameters:

accml_lib.core.bl.delta_backend module

class accml_lib.core.bl.delta_backend.DeltaBackendRProxy(*, backend, cache, filter=<accml_lib.core.bl.delta_backend.NOOPFilter object>)[source]

Bases: BackendR

handle delta properties

Parameters:
get_natural_view_name()[source]
async read(dev_id, prop_id)[source]
Return type:

object

Parameters:
async trigger(dev_id, prop_id)[source]
Parameters:
class accml_lib.core.bl.delta_backend.DeltaBackendRWProxy(backend, cache, filter=<accml_lib.core.bl.delta_backend.NOOPFilter object>)[source]

Bases: DeltaBackendRProxy, BackendRW

handle delta properties

Parameters:
async set(dev_id, prop_id, value)[source]
Parameters:
class accml_lib.core.bl.delta_backend.NOOPFilter[source]

Bases: FilterInterface

process(input)[source]
class accml_lib.core.bl.delta_backend.StateCache(*, name)[source]

Bases: object

Todo

abstract interface

Parameters:

name (str)

clear()[source]
get(id, default=None)[source]

Todo

add return type: shall support __sub__

keys()[source]
set(id, value)[source]
accml_lib.core.bl.delta_backend.delta_property(prop_id)[source]
Return type:

(bool, str)

Parameters:

prop_id (str)

accml_lib.core.bl.liaison_manager module

class accml_lib.core.bl.liaison_manager.LiaisonManager(forward_lut, inverse_lut)[source]

Bases: LiaisonManagerBase

Todo

consider internally to represent classes of devices with a certain functionallity

So internally have
  • classes of devices providing similar properties

  • this can be used when searching for suggesting alternatives to the user when searching for it

Parameters:
forward(id_)[source]
Return type:

DevicePropertyID

Parameters:

id_ (LatticeElementPropertyID)

Todo

for symmetry: should return a sequence too!

inverse(id_)[source]

needs to return a sequence: e.g. power converters often power more than one magnet

Return type:

LatticeElementPropertyID

Parameters:

id_ (DevicePropertyID)

accml_lib.core.bl.translator_service module

class accml_lib.core.bl.translator_service.TranslatorService(lut)[source]

Bases: TranslatorServiceBase

Parameters:

lut (Mapping[ConversionID, StateConversion])

get(id_)[source]
Return type:

StateConversion

Parameters:

id_ (ConversionID)

objects_for_device(id_)[source]
Parameters:

id_ (ConversionID)

objects_for_lat_elem(id_)[source]
Parameters:

id_ (ConversionID)

accml_lib.core.bl.unit_conversion module

class accml_lib.core.bl.unit_conversion.EnergyDependentLinearUnitConversion(*, intercept, slope, brho)[source]

Bases: StateConversion

Typical example: magnet parameters

Parameters:
forward(state)[source]

from “physics” to machine

Follows bluesky convention

Return type:

float

Parameters:

state (float)

inverse(state)[source]

from machine to “physics”

Follows bluesky convention

Return type:

float

Parameters:

state (float)

class accml_lib.core.bl.unit_conversion.LinearUnitConversion(*, intercept, slope)[source]

Bases: StateConversion

Typical example: tune

Parameters:
forward(state)[source]

from “physics” to machine

Follows bluesky convention

Return type:

float

Parameters:

state (float)

inverse(state)[source]

from machine to “physics”

Follows bluesky convention

Return type:

float

Parameters:

state (float)

accml_lib.core.bl.yellow_pages module

class accml_lib.core.bl.yellow_pages.FamilyName(value)[source]

Bases: Enum

master_clock = 'master_clock'
quadrupoles = 'quadrupoles'
tune_correction_quadrupoles = 'tune_correction_quadrupoles'
class accml_lib.core.bl.yellow_pages.YellowPages(d)[source]

Bases: YellowPagesBase

or use: get(family_name: str) separate yellow pages for lattice elements and devices

Parameters:

d (dict)

get(family_name)[source]

Return a sequence with all identifiers belonging to base class

Return type:

Sequence[str]

Parameters:

family_name (str | FamilyName)

quadrupole_names()[source]
Return type:

Sequence[str]

Todo

remove me: favour to only provide the .get interface

tune_correction_quadrupole_names()[source]
Return type:

Sequence[str]

Todo

remove me: favour to only provide the .get interface

Module contents