pylablib.devices.Attocube package¶
Submodules¶
pylablib.devices.Attocube.anc300 module¶
-
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
¶
-
update_available_axes
()[source]¶ Update the list of available axes.
Need to call only if the hardware configuration of the ANC module has changed.
-
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). Seeset_mode()
for the description of the modes.
-
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_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 ifpattern 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, orNone
(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.
-
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.
-
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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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)
- conn – connection parameters; for Ethernet connection is a tuple
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
¶
-
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
¶
-
-
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.
-
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.
-
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_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.
-
move_to
(axis, position, precision=None)[source]¶ Move to target position (in m).
If precision is not
None
, it sets final position tolerance.
-
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).
-
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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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.
-