pylablib.devices.Attocube package

Submodules

pylablib.devices.Attocube.anc300 module

pylablib.devices.Attocube.anc300.muxaxis(*args, **kwargs)[source]
class pylablib.devices.Attocube.anc300.TDeviceInfo(serial, version)

Bases: tuple

count()

Return number of occurrences of value.

index()

Return first index of value.

Raises ValueError if the value is not present.

serial
version
class pylablib.devices.Attocube.anc300.ANC300(conn, backend='auto', pwd='123456')[source]

Bases: pylablib.core.devio.comm_backend.ICommBackendWrapper, pylablib.devices.interface.stage.IMultiaxisStage

Attocube ANC300 controller.

Parameters:
  • conn – connection parameters; for Ethernet connection is a tuple (addr, port), a string "addr:port", or a string "addr" (default port 7240 us assumed)
  • backend (str) – communication backend; by default, try to determine from the communication parameters
  • pwd (str) – connection password for Ethernet connection (default is "123456")
Error

alias of pylablib.devices.Attocube.base.AttocubeError

open()[source]

Open the connection to the stage

query(msg)[source]

Send a query to the stage and return the reply

update_available_axes()[source]

Update the list of available axes.

Need to call only if the hardware configuration of the ANC module has changed.

get_device_info()[source]

Get the device info of the controller board: (serial, version)

get_axis_serial(axis='all')[source]

Get serial number of the controller board

set_mode(axis='all', mode='stp')[source]

Set axis mode.

axis is either an axis index (starting from 1), or "all" (all axes). mode can be "gnd" (ground), "stp" (step), "cap" (measure capacitance, then ground), "offs" (offset only, no stepping), "stp+" (offset with added stepping waveform), "stp-" (offset with subtracted stepping). Note that not all modes are supported by all modules: ANM150 doesn’t support offset voltage ("offs", "stp+", "stp-" modes), ANM200 doesn’t support stepping ("stp", "stp+", "stp-" modes).

get_mode(axis='all')[source]

Get axis mode.

axis is either an axis index (starting from 1), or "all" (all axes). See set_mode() for the description of the modes.

is_enabled(axis='all')[source]

Check if the axis is enabled

enable_axis(axis='all', mode='stp')[source]

Enable specific axis (set to step mode)

disable_axis(axis='all')[source]

Disable specific axis (set to ground mode)

measure_capacitance(axis='all', wait=True)[source]

Measure axis capacitance; finish in the GND mode.

If wait==True, wait until the capacitance measurement is finished (takes about a second per axis).

get_voltage(axis='all')[source]

Get axis step amplitude in Volts

set_voltage(axis, voltage)[source]

Set axis step amplitude in Volts

get_offset(axis='all')[source]

Get axis offset voltage in Volts

set_offset(axis, voltage)[source]

Set axis offset voltage in Volts

get_output(axis='all')[source]

Get axis current output voltage in Volts

get_frequency(axis='all')[source]

Get axis step frequency in Hz

set_frequency(axis, freq)[source]

Set axis step frequency in Hz

get_capacitance(axis='all', measure=False)[source]

Get capacitance measurement on the axis.

If measure==True, re-measure axis capacitance (takes about a second); otherwise, get the last measurement value.

get_voltage_pattern(axis, kind)[source]

Get axis voltage pattern.

kind be either "up" for up pattern or "down" for down pattern. The pattern is a numpy array of 256 numbers from 0 to 255 corresponding to the output voltage from 0 to the axis voltage. This pattern is output (repeatedly) for each step. The default is a simple linear ramp.

set_voltage_pattern(axis, kind, pattern=None)[source]

Set axis voltage pattern.

kind be either "up" for up pattern or "down" for down pattern. The pattern is an array of 256 numbers from 0 to 255 corresponding to the output voltage from 0 to the axis voltage. This pattern is output (repeatedly) for each step. The default is a simple linear ramp, which is set if pattern is None.

get_trigger_input(axis='all')[source]

Get trigger input lines for the given axis.

Return tuple (up, down) with values for up and down step triggers, which can be either integer with the trigger line number, or "off" if the trigger is off.

set_trigger_input(axis, up=None, down=None)[source]

Set trigger input lines for the given axis.

up and down are can be integer with the trigger line number, "off" if the trigger is off, or None (keep the value unchanged).

get_external_input_modes(axis='all')[source]

Get external BNC input modes.

Return tuple (acin, dcin) indicating whether AC-IN and DC-IN channels are enabled.

set_external_input_modes(axis, acin=None, dcin=None)[source]

Enable or disable external BNC inputs.

acin and dcin are can be boolean indicating if the corresponding input is enabled, or None (keep the value unchanged).

get_axis_correction(axis)[source]

Get axis correction factor.

The factor is automatically applied when the motion is in the negative direction.

set_axis_correction(axis, factor=1.0)[source]

Set axis correction factor.

The factor is automatically applied when the motion is in the negative direction.

jog(axis, direction)[source]

Jog continuously in the given direction ("+" or "-").

The motion will continue until another move or stop command is called.

move_by(axis, steps=1)[source]

Move a given axis for a given number of steps

wait_move(axis, timeout=30.0)[source]

Wait for a given axis to stop moving.

If the motion is not finished after timeout seconds, raise a backend error.

is_moving(axis)[source]

Check if a given axis is moving

stop(axis='all')[source]

Stop motion of a given axis

class NoParameterCaller(device, kind)

Bases: object

Class to simplify calling functions without a parameter

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the backend

get_all_axes()

Get the list of all available axes (taking mapping into account)

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

lock(timeout=None)

Lock the access to the device from other threads/processes (isn’t necessarily implemented)

locking(timeout=None)

Context manager for lock & unlock

remap_axes(mapping, accept_original=True)

Rename axes to the new labels.

mapping is the new axes mapping, which can be a list of new axes name (corresponding to the old axes in order returned by get_all_axes()), or a dictionary {alias: original} of the new axes aliases.

set_device_variable(key, value)

Set the value of a settings parameter

unlock()

Unlock the access to the device from other threads/processes (isn’t necessarily implemented)

pylablib.devices.Attocube.anc350 module

pylablib.devices.Attocube.anc350.get_usb_devices_number()[source]

Get the number of controllers connected via USB

class pylablib.devices.Attocube.anc350.ANC350(conn=0, timeout=5.0)[source]

Bases: pylablib.core.devio.comm_backend.ICommBackendWrapper, pylablib.devices.interface.stage.IMultiaxisStage

Attocube ANC350 controller.

Parameters:
  • conn – connection parameters - index of the Attocube ANC350 in the system (for a single controller leave 0)
  • timeout (float) – default operation timeout
Error

alias of pylablib.devices.Attocube.base.AttocubeError

class Telegram(opcode, address, index, data, corr_number)

Bases: tuple

address
corr_number
count()

Return number of occurrences of value.

data
index
opcode
class Reply(address, index, reason, data)

Bases: tuple

address
count()

Return number of occurrences of value.

data
index
reason
check_tell(timeout=0.01)[source]

Check for queued TELL (periodic value update) commands

set_value(address, index, value, ack=False)[source]

Set device value at the given address and index.

If ack==True, request ACK responds and return its value; otherwise, return immediately after set.

get_value(address, index, as_int=True)[source]

Get device value at the given address and index.

If as_int==True, convert the result into a signed integer; otherwise return raw byte string.

enable_updates(enabled=True)[source]

Enable or disable periodic TELL updates

get_hardware_id()[source]

Return device HWID (by default -1)

set_hardware_id(hwid, persist=False)[source]

Set device HWID (can be used to identify different devices).

If persist==True, the value persists after power cycling.

is_connected(axis='all')[source]

Check if axis is connected

is_enabled(axis='all')[source]

Check if axis is enabled

enable_axis(axis='all', enabled=True)[source]

Enable a specific axis or all axes

disable_axis(axis='all')[source]

Disable a specific axis or all axes

is_moving(axis='all')[source]

Move a given axis for a given number of steps

check_limit(axis='all')[source]

Check if the ent of travel has been reached.

Return None if no limits are reached, "fwd" if forward limit is reached, "bwd" if backward limit is reached, or "both" if both are reached together (normally shouldn’t happen).

get_status_n(axis='all')[source]

Get numerical status of the axis.

For details, see ANC350 protocol.

status_bits = [(1, 'running'), (2, 'limit'), (256, 'sens_err'), (1024, 'sens_disconn'), (2048, 'ref_valid')]
get_status(axis='all')[source]

Get device status.

Return list of status strings, which can include "running" (axis is moving), "limit" (one of the limits is reached), "sens_err" (sensor error), "sens_disconn" (sensor disconnected), or "ref_valid" (reference is valid).

get_target_position(axis='all')[source]

Get the target position for the given axis (the position towards which it is moving)

get_precision(axis='all')[source]

Get the axis precision in m (used for checking if the target is reached)

set_precision(axis='all', precision=1e-06)[source]

Set the axis precision in m (used for checking if the target is reached)

is_target_reached(axis='all', precision=None)[source]

Check if the target position is reached.

If precision is not None, it sets final position tolerance (in m).

get_sensor_voltage()[source]

Get position sensor voltage in Volts

set_sensor_voltage(voltage)[source]

Set position sensor voltage in Volts

get_voltage(axis='all')[source]

Get axis step voltage in Volts

set_voltage(axis, voltage)[source]

Set axis step voltage in Volts

get_offset(axis='all')[source]

Get axis offset voltage in Volts

set_offset(axis, voltage)[source]

Set axis offset voltage in Volts

get_frequency(axis='all')[source]

Get axis step frequency in Hz

set_frequency(axis, freq)[source]

Set axis step frequency in Hz

get_capacitance(axis='all', measure=False, delay=0.5)[source]

Get axis capacitance in F.

If measure==True, initialize the measurement and get the result after the measurement delay. Otherwise, return the last measured value.

get_position(axis='all')[source]

Get axis position (in m)

move_to(axis, position, precision=None)[source]

Move to target position (in m).

If precision is not None, it sets final position tolerance.

move_by(axis, dist)[source]

Move along a given axis by a given distance (in m)

move_by_steps(axis, steps=1)[source]

Move along a given axis by a given number of steps

wait_move(axis, precision=1e-06, timeout=10.0, period=0.01)[source]

Wait for a given axis to stop moving or to reach target position.

If the motion is not finished after timeout seconds, raise a backend error. Precision sets the final positioning precision (in m).

stop(axis='all')[source]

Stop motion of a given axis

jog(axis, direction)[source]

Jog a given axis in a given direction.

direction can be either "-" (negative) or "+" (positive). The motion continues until it is explicitly stopped, or until a limit is hit.

class NoParameterCaller(device, kind)

Bases: object

Class to simplify calling functions without a parameter

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the backend

get_all_axes()

Get the list of all available axes (taking mapping into account)

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

lock(timeout=None)

Lock the access to the device from other threads/processes (isn’t necessarily implemented)

locking(timeout=None)

Context manager for lock & unlock

open()

Open the backend

remap_axes(mapping, accept_original=True)

Rename axes to the new labels.

mapping is the new axes mapping, which can be a list of new axes name (corresponding to the old axes in order returned by get_all_axes()), or a dictionary {alias: original} of the new axes aliases.

set_device_variable(key, value)

Set the value of a settings parameter

unlock()

Unlock the access to the device from other threads/processes (isn’t necessarily implemented)

pylablib.devices.Attocube.base module

exception pylablib.devices.Attocube.base.AttocubeError[source]

Bases: pylablib.core.devio.base.DeviceError

Generic Attocube error

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception pylablib.devices.Attocube.base.AttocubeBackendError(exc)[source]

Bases: pylablib.devices.Attocube.base.AttocubeError, pylablib.core.devio.comm_backend.DeviceBackendError

Attocube backend communication error

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

Module contents