qmi.instruments.newport.ag_uc8

Instrument driver for the Newport Agilis AG-UC8 Piezo Stepper Controller.

Classes

AxisStatus(value)

Axis status codes.

Newport_AG_UC8(context, name, transport)

Instrument driver for the Newport AG-UC8 Piezo Stepper Controller.

class qmi.instruments.newport.ag_uc8.AxisStatus(value)

Axis status codes.

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class qmi.instruments.newport.ag_uc8.Newport_AG_UC8(context: QMI_Context, name: str, transport: str)

Instrument driver for the Newport AG-UC8 Piezo Stepper Controller.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

get_last_error() int

Send a TE command (get error of previous command) and return a numerical error code. This function is called automatically after each command sent to the device.

Raises:

QMI_InstrumentException – When a command results in error.

Returns:

Integer error code for previous command. Value 0 means no error (success).

See class attribute ERROR_CODES for the meaning of the codes.

Return type:

error

reset() None

Reset the motor controller. Re-enables remote mode afterwards

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

select_channel(channel: int) None

Select the specified channel.

The selected channel is attached to the motor drive electronics. This function is called automatically by methods which have a “channel” parameter.

Changing the channel is only allowed when the axis is not moving.

Parameters:

channel – The channel number. Must in range 1-4.

Raises:

QMI_UsageException – By invalid channel number input.

get_limit_status(channel: int) Tuple[bool, bool]

Get the limit switch status for the specified channel.

Parameters:

channel – Channel index (range 1 .. 4).

Raises:

QMI_InstrumentException if invalid response is received.

Returns:

Tuple (axis1_limit_active, axis2_limit_active).

get_step_delay(axis: int) int

Get step delay. :argument axis: Axis index (1 .. 2). :return: Step delay in units of 10 us.

set_step_delay(axis: int, value: int) None

Set step delay.

Parameters:
  • axis – Axis index (1 .. 2).

  • value – Step delay in units of 10 us (range 1 .. 200000).

get_step_amplitude(axis: int, direction: int) int

Get step amplitude.

Parameters:
  • axis – Axis index (1 .. 2).

  • direction – Direction (0=positive, 1=negative).

Raises:

QMI_UsageException by invalid direction index number.

Returns:

Step amplitude (1 .. 50).

set_step_amplitude(axis: int, direction: int, value: int) None

Set step amplitude.

Parameters:
  • axis – Axis index (1 .. 2).

  • direction – Step direction (0=positive, 1=negative).

  • value – New step amplitude (1 .. 50).

Raises:

QMI_UsageException by invalid direction index number.

get_step_count(axis: int) int

Get accumulated number of steps since last reset of the step counter.

Parameters:

axis – Axis index (1 .. 2).

Returns:

Number of steps (difference between positive and negative steps).

clear_step_count(axis: int) None

Reset the step counter to zero.

Parameters:

axis – Axis index (1 .. 2).

Raises:

QMI_UsageException by invalid axis index number.

get_axis_status(axis: int) AxisStatus

Get status of the axis.

Parameters:

axis – Axis index (1 .. 2).

Returns:

Axis status.

jog(channel: int, axis: int, speed: int) None

Start moving in specified direction at specified speed.

Parameters:
  • channel – Channel index (1 .. 4).

  • axis – Axis index (1 .. 2).

  • speed – Speed and direction. 0 = stop moving. positive values 1 .. 4 = move in positive direction. negative values -1 .. -4 = move in negative direction. See Newport_AG_UC8.SPEED_TABLE for the speed levels.

move_limit(channel: int, axis: int, speed: int) None

Start moving to positive or negative limit.

Parameters:
  • channel – Channel index (1 .. 4).

  • axis – Axis index (1 .. 2).

  • speed – Speed and direction. 0 = stop moving. positive values 1 .. 4 = move in positive direction. negative values -1 .. -4 = move in negative direction. See Newport_AG_UC8.SPEED_TABLE for the speed levels.

measure_position(channel: int, axis: int) int

Measure current position along the specified axis.

This is a slow command which may take up to 2 minutes to finish. It moves the axis to both limits, then back to its (approximate) original position.

Parameters:
  • channel – Channel index (1 .. 4).

  • axis – Axis index (1 .. 2).

Returns:

Position in range 0 .. 1000 representing the current position in units of 1/1000 of the total axis range.

move_abs(channel: int, axis: int, position: int) int

Move to absolute position.

This is a slow command which may take up to 2 minutes to finish. It moves the axis to both limits, then to its destination position.

Parameters:
  • channel – Channel index (1 .. 4).

  • axis – Axis index (1 .. 2).

  • position – Target position in range 0 .. 1000, in units of 1/1000 of the total axis range.

move_rel(channel: int, axis: int, steps: int) None

Start relative movement.

Parameters:
  • channel – Channel index (1 .. 4).

  • axis – Axis index (1 .. 2).

  • steps – Number of steps to move relative to the current position. Positive values move in positive direction; negative values move in negative direction.

Raises:

QMI_UsageException by input steps number out of range.

stop(axis: int) None

Stop current movement.

Parameters:

axis – Axis index (1 .. 2).

Raises:

QMI_UsageException by invalid axis index number.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.