pyaml.common.abstract#

Abstract read/write interfaces for scalar and array values.

The interfaces define the small protocol used by PyAML runtime elements to read values, write setpoints, report units, and map scalar channels onto array-backed data.

Classes

RWMapper(bind, idx)

Expose one array element through a scalar read/write interface.

ReadFloatArray()

Define read-only access to an array of floating-point values.

ReadFloatScalar()

Define read-only access to one floating-point value.

ReadWriteFloatArray()

Define read/write access to an array of floating-point values.

ReadWriteFloatScalar()

Define read/write access to one floating-point value.

class pyaml.common.abstract.RWMapper(bind, idx)#

Bases: ReadWriteFloatScalar

Expose one array element through a scalar read/write interface.

Parameters:
  • bind (ReadWriteFloatArray) – Array interface containing the mapped value.

  • idx (int) – Zero-based index of the mapped element.

Methods

get()

Get the value at the mapped index.

set()

Set the value at the mapped index.

set_and_wait()

Set the value and wait for it to reach the setpoint.

unit()

Get the unit for the value.

index()

Get the mapped array index.

get()#

Get the value at the mapped index.

Returns:

float – Value at the mapped array index

Return type:

float

index()#

Get the mapped array index.

Returns:

int – The index in the array that this scalar maps to

Return type:

int

set(value)#

Set the value at the mapped index.

Parameters:

value (float) – Value to set

set_and_wait(value)#

Set the value and wait for it to reach the setpoint.

Parameters:

value (float) – Target value to set and wait for

Raises:

NotImplementedError – This method is not yet implemented

unit()#

Get the unit for the value.

Returns:

str – Unit string for the value at the mapped index

Return type:

str

class pyaml.common.abstract.ReadFloatArray#

Bases: object

Define read-only access to an array of floating-point values.

Methods

get()

Return the current values as an array.

unit()

Return the units associated with the array values.

abstractmethod get()#

Return the current values as an array.

abstractmethod unit()#

Return the units associated with the array values.

class pyaml.common.abstract.ReadFloatScalar#

Bases: object

Define read-only access to one floating-point value.

Methods

get()

Return the current scalar value.

unit()

Return the physical unit of the scalar value.

abstractmethod get()#

Return the current scalar value.

Returns:

float – Current value.

Return type:

float64

abstractmethod unit()#

Return the physical unit of the scalar value.

Returns:

str – Unit label.

Return type:

str

class pyaml.common.abstract.ReadWriteFloatArray#

Bases: ReadFloatScalar

Define read/write access to an array of floating-point values.

Methods

set()

Write array values in the interface’s defined order.

set_and_wait()

Write array values and wait for readback confirmation.

abstractmethod set(value)#

Write array values in the interface’s defined order.

Parameters:

value (numpy.ndarray) – Values to write.

abstractmethod set_and_wait(value)#

Write array values and wait for readback confirmation.

Parameters:

value (numpy.ndarray) – Target values.

class pyaml.common.abstract.ReadWriteFloatScalar#

Bases: ReadFloatScalar

Define read/write access to one floating-point value.

Methods

set()

Write a scalar setpoint.

set_and_wait()

Write a setpoint and wait for readback confirmation.

abstractmethod set(value)#

Write a scalar setpoint.

Parameters:

value (float) – Value to write.

abstractmethod set_and_wait(value)#

Write a setpoint and wait for readback confirmation.

Parameters:

value (float) – Target value.