qcodes_contrib_drivers.drivers.Attocube.ANC350Lib package

Submodules

qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface module

Collection of shared classes used by multiple versions of ANC350Lib

Author:

Lukas Lankes, Forschungszentrum Jülich GmbH / ZEA-2, l.lankes@fz-juelich.de

exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibError(message: str | None, code: int | None)[source]

Bases: Exception, ABC

Base class for exceptions occurring in ANC350v?Lib-classes

message

Error message

code

Error code from dll (or None)

__init__(message: str | None, code: int | None)[source]

Create instance of ANC350LibError

Parameters:
  • message – Error message

  • code – Error code from dll

classmethod check_error(code: int, function: str | None = None) None[source]

Checks the error code and raises an exception, if necessary

If the error code is in SUCCESS_CODES, no exception is raises. Same applies if the code is contained in WARNING_CODES. Then, a warning is generated. If neither of both is the case, an exception is generated based on the error code.

Parameters:
  • code – Occurred error code

  • function – Dll-function that returned the error code

Raises:

If code is not in SUCCESS_CODES or WARNING_CODES, an ANC350LibError is raised

SUCCESS_CODES: List[int] = [0]
WARNING_CODES: List[int] = []
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibActuatorType(value)[source]

Bases: IntEnum

An enumeration of possible return values ANC350v3Lib.get_actuator_type and ANC350v4Lib.get_actuator_type.

Goniometer = 1
Linear = 0
Rotator = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibAmplitudeControlMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_amplitude_control_mode.

Amplitude = 1
Speed = 0
StepSize = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibDeviceType(value)[source]

Bases: IntEnum

An enumeration for possible values of the return value’s first component in ANC350v3Lib.get_device_info and ANC350v4Lib.get_device_info

Fps = 2
Nothing = 3
Num = 1
Res = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibExternalTriggerMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v3Lib.configure_ext_trigger and ANC350v4Lib.configure_ext_trigger.

Disable = 0
Quadrature = 1
Trigger = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibSignalEdge(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “edge” in ANC350v2Lib.set_external_step_input_edge.

Falling = 1
Rising = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibTriggerInputMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_input_trigger_mode.

Coarse = 2
Disable = 0
Quadratur = 1
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibTriggerOutputMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_output_trigger_mode.

Disable = 0
IcHaus = 3
Position = 1
Quadratur = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.interface.ANC350LibTriggerPolarity(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “polarity” in ANC350v2Lib.set_trigger_polarity, ANC350v3Lib.configure_rng_trigger_pol and ANC350v4Lib.configure_rng_trigger_pol.

High = 1
Low = 0

qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3 module

ANC350v3Lib is a Python wrapper for the C++ library of the Attocube ANC350 driver (version 3)

It depends on anc350v3.dll (and libusb0.dll) which are provided by Attocube on the installation disc. You can find the dll files for 32-bit and 64-bit in folder ANC350_Library. Please the dlls into the working directory or specify the path when instantiating the ANC350v3Lib.

Author:

Lukas Lankes, Forschungszentrum Jülich GmbH / ZEA-2, l.lankes@fz-juelich.de

exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350LibError(message: str | None, code: int | None)[source]

Bases: Exception, ABC

Base class for exceptions occurring in ANC350v?Lib-classes

message

Error message

code

Error code from dll (or None)

__init__(message: str | None, code: int | None)[source]

Create instance of ANC350LibError

Parameters:
  • message – Error message

  • code – Error code from dll

classmethod check_error(code: int, function: str | None = None) None[source]

Checks the error code and raises an exception, if necessary

If the error code is in SUCCESS_CODES, no exception is raises. Same applies if the code is contained in WARNING_CODES. Then, a warning is generated. If neither of both is the case, an exception is generated based on the error code.

Parameters:
  • code – Occurred error code

  • function – Dll-function that returned the error code

Raises:

If code is not in SUCCESS_CODES or WARNING_CODES, an ANC350LibError is raised

SUCCESS_CODES: List[int] = [0]
WARNING_CODES: List[int] = []
exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350v3LibError(message: str | None = None, code: int | None = None)[source]

Bases: ANC350LibError

Exception class for errors occurring in ANC350v3Lib and ANC350v4Lib

message

Error message

code

Error code from dll (or None)

__init__(message: str | None = None, code: int | None = None)[source]

Create instance of ANC350v3LibError

Parameters:
  • message – Error message

  • code – Error code from dll

class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350LibActuatorType(value)[source]

Bases: IntEnum

An enumeration of possible return values ANC350v3Lib.get_actuator_type and ANC350v4Lib.get_actuator_type.

Goniometer = 1
Linear = 0
Rotator = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350LibDeviceType(value)[source]

Bases: IntEnum

An enumeration for possible values of the return value’s first component in ANC350v3Lib.get_device_info and ANC350v4Lib.get_device_info

Fps = 2
Nothing = 3
Num = 1
Res = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350LibExternalTriggerMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v3Lib.configure_ext_trigger and ANC350v4Lib.configure_ext_trigger.

Disable = 0
Quadrature = 1
Trigger = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350LibTriggerPolarity(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “polarity” in ANC350v2Lib.set_trigger_polarity, ANC350v3Lib.configure_rng_trigger_pol and ANC350v4Lib.configure_rng_trigger_pol.

High = 1
Low = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v3.ANC350v3Lib(path_to_dll: str | None = None)[source]

Bases: object

A wrapper class for version 3 of the ANC350 driver anc350v3.dll

This class adapts all functions of anc350v3.dll and forwards its calls to the dll.

__init__(path_to_dll: str | None = None)[source]

Creates an instance of the anc350v3.dll-wrapper

Parameters:

path_to_dll – Path to anc350v3.dll or None, if it’s stored in the working directory

configure_a_quad_b_in(dev_handle: c_void_p, axis_no: int, enable: bool, resolution: float) None[source]

Configure A-Quad-B Input

Enables and configures the A-Quad-B (quadrature) input for the target position.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) A-Quad-B input

  • resolution – A-Quad-B step width in meters [m]. Internal resolution is 1 nm.

Raises:

ANC350LibError is raised, if the function call fails

configure_a_quad_b_out(dev_handle: c_void_p, axis_no: int, enable: bool, resolution: float, clock: float) None[source]

Configure A-Quad-B Output

Enables and configures the A-Quad-B (quadrature) output of the current position.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) A-Quad-B output

  • resolution – A-Quad-B step width in meters [m]. Internal resolution is 1 nm.

  • clock – Clock of the A-Quad-B output in seconds [s]. Allowed range is 40ns … 1.3ms; internal resolution is 20ns.

Raises:

ANC350LibError is raised, if the function call fails

configure_duty_cycle(dev_handle: c_void_p, axis_no: int, period: float, off_time: float) None[source]

Configure Duty Cycle Parameters

Enables and configures the sensor’s duty cycle for all axes. Requires the duty cycle feature to be installed. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • period – Duty cycle period in seconds [s]

  • off_time – Duty cycle off time in seconds [s]

Raises:

ANC350LibError is raised, if the function call fails

configure_ext_trigger(dev_handle: c_void_p, axis_no: int, mode: ANC350LibExternalTriggerMode | int) None[source]

Configure Trigger Input

Enables the input trigger for steps.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • mode – Disable (0), quadrature (1) or trigger(2) for external triggering

Raises:

ANC350LibError is raised, if the function call fails

configure_nsl_trigger(dev_handle: c_void_p, enable: bool) None[source]

Configure NSL Trigger

Enables NSL input as trigger source.

Parameters:
  • dev_handle – Handle of the device to access

  • enable – Disable (False) or enable (True)

Raises:

ANC350LibError is raised, if the function call fails

configure_nsl_trigger_axis(dev_handle: c_void_p, axis_no: int) None[source]

Configure NSL Trigger Axis

Selects axis for NSL trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger(dev_handle: c_void_p, axis_no: int, lower: int, upper: int) None[source]

Configure Range Trigger

Configure lower position for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • lower – Lower position for range trigger in nanometers [nm]

  • upper – Upper position for range trigger in nanometers [nm]

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger_eps(dev_handle: c_void_p, axis_no: int, epsilon: int) None[source]

Configure Epsilon of Range Trigger

Configure hysteresis for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • epsilon – Hysteresis in nanometers per millidegree [nm/m°]

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger_pol(dev_handle: c_void_p, axis_no: int, polarity: ANC350LibTriggerPolarity | int) None[source]

Configure Polarity of Range Trigger

Configure lower position for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • polarity – Polarity of trigger signal when position is between lower and upper Low(0) and High(1)

Raises:

ANC350LibError is raised, if the function call fails

connect(dev_no: int = 0) c_void_p[source]

Connect Device

Initializes and connects the selected device. This has to be done before any access to control variables or measured data.

Parameters:

dev_no – Sequence number of the device. Must be smaller than the return value from the last discover call (default: 0).

Returns:

Handle to the opened device; or None on error

Return type:

device

Raises:

ANC350LibError is raised, if the function call fails

disconnect(dev_handle: c_void_p) None[source]

Disconnect Device

Closes the connection to the device. The device handle becomes invalid.

Parameters:

dev_handle – Handle of the device to close

Raises:

ANC350LibError is raised, if the function call fails

discover(search_usb: bool = True, search_tcp: bool = True) int[source]

Discover Devices

The function searches for connected ANC350RES devices on USB and LAN and initializes internal data structures per device. Devices that arwe in use by another application or PC are not found. The function must be called before connecting to a device and must not be called as long as any devices are connected.

The number of devices found is returned. In subsequent functions, devices are identified by a sequence number that must be less than the number returned.

Parameters:
  • search_usb – True (default) to search for USB devices; False otherwise

  • search_tcp – True (default) to search for TCP/IP devices; False otherwise

Returns:

Number of devices found

Raises:

ANC350LibError is raised, if the function call fails

enable_ref_auto_reset(dev_handle: c_void_p, axis_no: int, enable: bool) None[source]

Enable Position Auto Reset

Enables or disables the position auto reset for an axis. When enabled, every time the reference marking is hit, the position will be set to zero. When disabled, the reference marking will be ignored. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) the feature

Raises:

ANC350LibError is raised, if the function call fails

enable_ref_auto_update(dev_handle: c_void_p, axis_no: int, enable: bool) None[source]

Enable Reference Auto Update

Enables or disables the reference auto update for an axis. When enabled, every time the reference marking is hit, the reference position will be updated. When disabled, the reference marking will be considered only the first time, later hits will be ignored. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) the feature

Raises:

ANC350LibError is raised, if the function call fails

enable_sensor(dev_handle: c_void_p, enable: bool) None[source]

Switch Sensor Power

Switches the sensor power for all axes on or off. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • enable – Enable (True) or disable (False) the sensor

Raises:

ANC350LibError is raised, if the function call fails

get_actuator_name(dev_handle: c_void_p, axis_no: int) str[source]

Get Actuator Name

Get the name of the currently selected actuator

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Name of the actuator

Raises:

ANC350LibError is raised, if the function call fails

get_actuator_type(dev_handle: c_void_p, axis_no: int) ANC350LibActuatorType[source]

Get Actuator Type

Get the type of the currently selected actuator

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Type of the actuator

Raises:

ANC350LibError is raised, if the function call fails

get_amplitude(dev_handle: c_void_p, axis_no: int) float[source]

Read Back Amplitude

Reads back the amplitude parameter of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Amplitude in Volts [V]

Raises:

ANC350LibError is raised, if the function call fails

get_axis_status(dev_handle: c_void_p, axis_no: int) Tuple[bool, bool, bool, bool, bool, bool, bool][source]

Read Axis Status

Reads status information about an axis of the device.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

  1. connected: True, if the axis is connected to a sensor.

  2. enabled: True, if the axis voltage output is enabled.

  3. moving: True, if the axis is moving.

  4. target: True, if the target is reached in automatic positioning.

  5. eot_fwd: True, if end of travel detected in forward direction.

  6. eot_bwd: True, if end of travel detected in backward direction.

  7. error: True, if the axis’ sensor is in error state.

Return type:

A tuple containing the axis status

Raises:

ANC350LibError is raised, if the function call fails

get_device_config(dev_handle: c_void_p) Tuple[bool, bool, bool, bool][source]

Read Device Configuration

Reads static device configuration data

Parameters:

dev_handle – Handle of the device to access

Returns:

  1. sync: Ethernet enabled (True) or disabled (False)

  2. lockin: Low power loss measurement enabled (True) or disabled (False)

  3. duty: Duty cycle enabled (True) or disabled (False)

  4. app: Control by iOS app enabled (True) or disabled (False)

Return type:

A tuple containing which features of the device are enabled

Raises:

ANC350LibError is raised, if the function call fails

get_device_info(dev_no: int = 0) Tuple[ANC350LibDeviceType, int, str, str, bool][source]

Device Information

Returns available information about a device. The function can not be called before discover but the devices don’t have to be connected with connect. All Pointers to output parameters may be zero to ignore the respective value.

Parameters:

dev_no – Sequence number of the device. Must be smaller than the return value from the last ANC_discover call (default: 0).

Returns:

  1. dev_type: Type of the ANC350 device

  2. id: Programmed hardware ID of the device

  3. serial: The device’s serial number

  4. address: The device’s interface address if applicable. Returns the IP address in

    dotted-decimal notation or the string “USB”, respectively

  5. connected: True, if the device is already connected

Return type:

A tuple containing the device’s information

Raises:

ANC350LibError is raised, if the function call fails

get_firmware_version(dev_handle: c_void_p) int[source]

Firmware version

Retrieves the version of currently loaded firmware.

Parameters:

dev_handle – Handle of the device to access

Returns:

Version number

Raises:

ANC350LibError is raised, if the function call fails

get_frequency(dev_handle: c_void_p, axis_no: int) float[source]

Read back Frequency

Reads back the frequency parameter of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Frequency in Hertz [Hz]

Raises:

ANC350LibError is raised, if the function call fails

get_position(dev_handle: c_void_p, axis_no: int) float[source]

Read Current Position

Retrieves the current actuator position. For linear type actuators the position unit is m; for goniometers and rotators it is degree.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Current position in meters [m] or degrees [°]

Raises:

ANC350LibError is raised, if the function call fails

get_ref_position(dev_handle: c_void_p, axis_no: int) Tuple[float, bool][source]

Read Reference Position

Retrieves the current reference position. For linear type actuators the position unit is meter [m]; for goniometers and rotators it is degree [°]. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

  1. position: Current reference position in meters [m] or degrees [°].

  2. valid: True, if the reference position is valid.

Return type:

Tuple containing the reference position

Raises:

ANC350LibError is raised, if the function call fails

measure_capacitance(dev_handle: c_void_p, axis_no: int) float[source]

Measure Motor Capacitance

Performs a measurement of the capacitance of the piezo motor and returns the result. If no motor is connected, the result will be 0. The function doesn’t return before the measurement is complete; this will take a few seconds of time.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Capacitance in Farad [F]

Raises:

ANC350LibError is raised, if the function call fails

move_reference(dev_handle: c_void_p, axis_no: int) None[source]

Reset Reference

Starts an approach to the reference position. A running motion command is aborted; automatic moving (see start_auto_move) is switched on. Requires a valid reference position. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

reset_position(dev_handle: c_void_p, axis_no: int) None[source]

Reset Position

Sets the current (relative) position of an axis to Zero. Only applicable for NUM and FPS devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

save_params(dev_handle: c_void_p) None[source]

Save Parameters

Saves parameters to persistent flash memory in the device. They will be present as defaults after the next power-on. The following parameters are affected: * amplitude (see set_amplitude) * frequency (see set_frequency) * target range (see set_target_range) * target ground (see set_target_ground) * actuator selection (see select_actuator) * trigger and quadrature settings

Parameters:

dev_handle – Handle of the device to access

Raises:

ANC350LibError is raised, if the function call fails

select_actuator(dev_handle: c_void_p, axis_no: int, actuator: int) None[source]

Select Actuator

Selects the actuator to be used for the axis from actuator presets.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • actuator – Actuator selection (0..255)

Raises:

ANC350LibError is raised, if the function call fails

set_amplitude(dev_handle: c_void_p, axis_no: int, amplitude: float) None[source]

Set Amplitude

Sets the amplitude parameter for an axis

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • amplitude – Amplitude in Volts [V] (internal resolution is 1mV)

Raises:

ANC350LibError is raised, if the function call fails

set_axis_output(dev_handle: c_void_p, axis_no: int, enable: bool, auto_disable: bool) None[source]

Enable Axis Output

Enables or disables the voltage output of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – True, to enable the voltage output. False, to disable it.

  • auto_disable – True, if the voltage output is to be deactivated automatically when end of travel is detected.

Raises:

ANC350LibError is raised, if the function call fails

set_dc_voltage(dev_handle: c_void_p, axis_no: int, voltage: float) None[source]

Set DC Output Voltage

Sets the DC level on the voltage output when no sawtooth based motion and no feedback loop is active.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • voltage – DC output voltage in Volts [V], internal resolution is 1 mV

Raises:

ANC350LibError is raised, if the function call fails

set_frequency(dev_handle: c_void_p, axis_no: int, frequency: float) None[source]

Set Frequency

Sets the frequency parameter for an axis

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • frequency – Frequency in Hertz [Hz], internal resolution is 1 Hz (although DLL accepts double-values)

Raises:

ANC350LibError is raised, if the function call fails

set_target_position(dev_handle: c_void_p, axis_no: int, target: float) None[source]

Set Target Position

Sets the target position for automatic motion, see start_auto_move. For linear type actuators the position unit is m, for goniometers and rotators it is degree.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target – Target position in meters [m] or degrees [°]. Internal resolution is 1 nm or 1 µ°.

Raises:

ANC350LibError is raised, if the function call fails

set_target_range(dev_handle: c_void_p, axis_no: int, target_range: float) None[source]

Set Target Range

Defines the range around the target position where the target is considered to be reached.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target_range – Target range in meters [m] or degrees [°]. Internal resolution is 1 nm or 1 µ°.

Raises:

ANC350LibError is raised, if the function call fails

start_auto_move(dev_handle: c_void_p, axis_no: int, enable: bool, relative: bool) None[source]

Set Automatic Motion

Switches automatic moving (i.e. following the target position) on or off

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enables (True) or disables (False) automatic motion

  • relative – If the target position is to be interpreted absolute (False) or relative to the current position (True)

Raises:

ANC350LibError is raised, if the function call fails

start_continuous_move(dev_handle: c_void_p, axis_no: int, start: bool, backward: bool) None[source]

Continuous Motion

Starts or stops continous motion in forward or backward direction. Other kinds of motion are stopped.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • start – Starts (True) or stops (False) the motion

  • backward – Step direction forward (False) or backward (True)

Raises:

ANC350LibError is raised, if the function call fails

start_single_step(dev_handle: c_void_p, axis_no: int, backward: bool) None[source]

Single Step

Triggers a single step in desired direction.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • backward – Step direction forward (False) or backward (True)

Raises:

ANC350LibError is raised, if the function call fails

DEFAULT_PATH_TO_DLL = 'anc350v3.dll'

qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4 module

ANC350v4Lib is a Python wrapper for the C++ library of the Attocube ANC350 driver (version 4)

It depends on anc350v4.dll (and libusb0.dll) which are provided by Attocube on the installation disc. You can find the dll files for 32-bit and 64-bit in folder ANC350_Library. Please the dlls into the working directory or specify the path when instantiating the ANC350v4Lib.

Author:

Lukas Lankes, Forschungszentrum Jülich GmbH / ZEA-2, l.lankes@fz-juelich.de

exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350LibError(message: str | None, code: int | None)[source]

Bases: Exception, ABC

Base class for exceptions occurring in ANC350v?Lib-classes

message

Error message

code

Error code from dll (or None)

__init__(message: str | None, code: int | None)[source]

Create instance of ANC350LibError

Parameters:
  • message – Error message

  • code – Error code from dll

classmethod check_error(code: int, function: str | None = None) None[source]

Checks the error code and raises an exception, if necessary

If the error code is in SUCCESS_CODES, no exception is raises. Same applies if the code is contained in WARNING_CODES. Then, a warning is generated. If neither of both is the case, an exception is generated based on the error code.

Parameters:
  • code – Occurred error code

  • function – Dll-function that returned the error code

Raises:

If code is not in SUCCESS_CODES or WARNING_CODES, an ANC350LibError is raised

SUCCESS_CODES: List[int] = [0]
WARNING_CODES: List[int] = []
exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350v3LibError(message: str | None = None, code: int | None = None)[source]

Bases: ANC350LibError

Exception class for errors occurring in ANC350v3Lib and ANC350v4Lib

message

Error message

code

Error code from dll (or None)

__init__(message: str | None = None, code: int | None = None)[source]

Create instance of ANC350v3LibError

Parameters:
  • message – Error message

  • code – Error code from dll

class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350LibActuatorType(value)[source]

Bases: IntEnum

An enumeration of possible return values ANC350v3Lib.get_actuator_type and ANC350v4Lib.get_actuator_type.

Goniometer = 1
Linear = 0
Rotator = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350LibDeviceType(value)[source]

Bases: IntEnum

An enumeration for possible values of the return value’s first component in ANC350v3Lib.get_device_info and ANC350v4Lib.get_device_info

Fps = 2
Nothing = 3
Num = 1
Res = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350LibExternalTriggerMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v3Lib.configure_ext_trigger and ANC350v4Lib.configure_ext_trigger.

Disable = 0
Quadrature = 1
Trigger = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350LibTriggerPolarity(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “polarity” in ANC350v2Lib.set_trigger_polarity, ANC350v3Lib.configure_rng_trigger_pol and ANC350v4Lib.configure_rng_trigger_pol.

High = 1
Low = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.v4.ANC350v4Lib(path_to_dll: str | None = None)[source]

Bases: ANC350v3Lib

A wrapper class for version 4 of the ANC350 driver anc350v4.dll

This class adapts all functions of anc350v4.dll and forwards its calls to the dll. ANC350v4Lib is backwards compatible to ANC350v3Lib; version 4 only has some more functions.

__init__(path_to_dll: str | None = None)[source]

Creates an instance of the anc350v4.dll-wrapper

Parameters:

path_to_dll – Path to anc350v4.dll or None, if it’s stored in the working directory

get_dc_voltage(dev_handle: c_void_p, axis_no: int) float[source]

Read back DC Output Voltage

Reads back the current DC level. It may be the level that has been set by set_dc_voltag or the value currently adjusted by the feedback controller.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

DC output voltage in Volts [V]

Raises:

ANC350LibError is raised, if the function call fails

get_lut_name(dev_handle: c_void_p, axis_no: int) str[source]

Get LUT Name

Get the name of the currently selected sensor look-up table. The function is only available in RES devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Name of the look-up table.

Raises:

ANC350LibError is raised, if the function call fails

load_lut_file(dev_handle: c_void_p, axis_no: int, file_name: str) None[source]

Load Lookup Table

Loads a sensor lookup table from a file into the device. The function is only available in RES devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • file_name – Name of the LUT file to read, optionally with path.

Raises:

ANC350LibError is raised, if the function call fails

register_external_ip(hostname: str) bool[source]

Register IP Device in external Network

discover is able to find devices connected via TCP/IP in the same network segment, but it can’t “look through” routers. To connect devices in external networks, reachable by routing, the IP addresses of those devices have to be registered prior to calling discover. The function registers one device and can be called several times.

The function will return True, if the name resolution succeeds (False otherwise); it doesn’t test if the device is reachable. Registered and reachable devices will be found by discover.

Parameters:

hostname – Hostname or IP Address in dotted decimal notation of the device to register.

Returns:

True, if the name resolution succeeds. This doesn’t guarantee that the device is reachable. False, if the hostname couldn’t be resolved.

Raises:

ANC350LibError is raised, if the function call fails

set_target_ground(dev_handle: c_void_p, axis_no: int, target_ground: bool) None[source]

Set Target Ground Flag

Sets or clears the Target Ground Flag. It determines the action performed in automatic positioning mode when the target position is reached. If set, the DC output is set to 0V and the position control feedback loop is stopped.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target_ground – Target Ground Flag

Raises:

ANC350LibError is raised, if the function call fails

DEFAULT_PATH_TO_DLL = 'anc350v4.dll'

Module contents

exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibError(message: str | None, code: int | None)[source]

Bases: Exception, ABC

Base class for exceptions occurring in ANC350v?Lib-classes

message

Error message

code

Error code from dll (or None)

__init__(message: str | None, code: int | None)[source]

Create instance of ANC350LibError

Parameters:
  • message – Error message

  • code – Error code from dll

classmethod check_error(code: int, function: str | None = None) None[source]

Checks the error code and raises an exception, if necessary

If the error code is in SUCCESS_CODES, no exception is raises. Same applies if the code is contained in WARNING_CODES. Then, a warning is generated. If neither of both is the case, an exception is generated based on the error code.

Parameters:
  • code – Occurred error code

  • function – Dll-function that returned the error code

Raises:

If code is not in SUCCESS_CODES or WARNING_CODES, an ANC350LibError is raised

SUCCESS_CODES: List[int] = [0]
WARNING_CODES: List[int] = []
exception qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350v3LibError(message: str | None = None, code: int | None = None)[source]

Bases: ANC350LibError

Exception class for errors occurring in ANC350v3Lib and ANC350v4Lib

message

Error message

code

Error code from dll (or None)

__init__(message: str | None = None, code: int | None = None)[source]

Create instance of ANC350v3LibError

Parameters:
  • message – Error message

  • code – Error code from dll

class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibActuatorType(value)[source]

Bases: IntEnum

An enumeration of possible return values ANC350v3Lib.get_actuator_type and ANC350v4Lib.get_actuator_type.

Goniometer = 1
Linear = 0
Rotator = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibAmplitudeControlMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_amplitude_control_mode.

Amplitude = 1
Speed = 0
StepSize = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibDeviceType(value)[source]

Bases: IntEnum

An enumeration for possible values of the return value’s first component in ANC350v3Lib.get_device_info and ANC350v4Lib.get_device_info

Fps = 2
Nothing = 3
Num = 1
Res = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibExternalTriggerMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v3Lib.configure_ext_trigger and ANC350v4Lib.configure_ext_trigger.

Disable = 0
Quadrature = 1
Trigger = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibSignalEdge(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “edge” in ANC350v2Lib.set_external_step_input_edge.

Falling = 1
Rising = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibTriggerInputMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_input_trigger_mode.

Coarse = 2
Disable = 0
Quadratur = 1
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibTriggerOutputMode(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “mode” in ANC350v2Lib.set_output_trigger_mode.

Disable = 0
IcHaus = 3
Position = 1
Quadratur = 2
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350LibTriggerPolarity(value)[source]

Bases: IntEnum

An enumeration for possible values of parameter “polarity” in ANC350v2Lib.set_trigger_polarity, ANC350v3Lib.configure_rng_trigger_pol and ANC350v4Lib.configure_rng_trigger_pol.

High = 1
Low = 0
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350v3Lib(path_to_dll: str | None = None)[source]

Bases: object

A wrapper class for version 3 of the ANC350 driver anc350v3.dll

This class adapts all functions of anc350v3.dll and forwards its calls to the dll.

__init__(path_to_dll: str | None = None)[source]

Creates an instance of the anc350v3.dll-wrapper

Parameters:

path_to_dll – Path to anc350v3.dll or None, if it’s stored in the working directory

configure_a_quad_b_in(dev_handle: c_void_p, axis_no: int, enable: bool, resolution: float) None[source]

Configure A-Quad-B Input

Enables and configures the A-Quad-B (quadrature) input for the target position.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) A-Quad-B input

  • resolution – A-Quad-B step width in meters [m]. Internal resolution is 1 nm.

Raises:

ANC350LibError is raised, if the function call fails

configure_a_quad_b_out(dev_handle: c_void_p, axis_no: int, enable: bool, resolution: float, clock: float) None[source]

Configure A-Quad-B Output

Enables and configures the A-Quad-B (quadrature) output of the current position.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) A-Quad-B output

  • resolution – A-Quad-B step width in meters [m]. Internal resolution is 1 nm.

  • clock – Clock of the A-Quad-B output in seconds [s]. Allowed range is 40ns … 1.3ms; internal resolution is 20ns.

Raises:

ANC350LibError is raised, if the function call fails

configure_duty_cycle(dev_handle: c_void_p, axis_no: int, period: float, off_time: float) None[source]

Configure Duty Cycle Parameters

Enables and configures the sensor’s duty cycle for all axes. Requires the duty cycle feature to be installed. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • period – Duty cycle period in seconds [s]

  • off_time – Duty cycle off time in seconds [s]

Raises:

ANC350LibError is raised, if the function call fails

configure_ext_trigger(dev_handle: c_void_p, axis_no: int, mode: ANC350LibExternalTriggerMode | int) None[source]

Configure Trigger Input

Enables the input trigger for steps.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • mode – Disable (0), quadrature (1) or trigger(2) for external triggering

Raises:

ANC350LibError is raised, if the function call fails

configure_nsl_trigger(dev_handle: c_void_p, enable: bool) None[source]

Configure NSL Trigger

Enables NSL input as trigger source.

Parameters:
  • dev_handle – Handle of the device to access

  • enable – Disable (False) or enable (True)

Raises:

ANC350LibError is raised, if the function call fails

configure_nsl_trigger_axis(dev_handle: c_void_p, axis_no: int) None[source]

Configure NSL Trigger Axis

Selects axis for NSL trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger(dev_handle: c_void_p, axis_no: int, lower: int, upper: int) None[source]

Configure Range Trigger

Configure lower position for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • lower – Lower position for range trigger in nanometers [nm]

  • upper – Upper position for range trigger in nanometers [nm]

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger_eps(dev_handle: c_void_p, axis_no: int, epsilon: int) None[source]

Configure Epsilon of Range Trigger

Configure hysteresis for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • epsilon – Hysteresis in nanometers per millidegree [nm/m°]

Raises:

ANC350LibError is raised, if the function call fails

configure_rng_trigger_pol(dev_handle: c_void_p, axis_no: int, polarity: ANC350LibTriggerPolarity | int) None[source]

Configure Polarity of Range Trigger

Configure lower position for range trigger.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • polarity – Polarity of trigger signal when position is between lower and upper Low(0) and High(1)

Raises:

ANC350LibError is raised, if the function call fails

connect(dev_no: int = 0) c_void_p[source]

Connect Device

Initializes and connects the selected device. This has to be done before any access to control variables or measured data.

Parameters:

dev_no – Sequence number of the device. Must be smaller than the return value from the last discover call (default: 0).

Returns:

Handle to the opened device; or None on error

Return type:

device

Raises:

ANC350LibError is raised, if the function call fails

disconnect(dev_handle: c_void_p) None[source]

Disconnect Device

Closes the connection to the device. The device handle becomes invalid.

Parameters:

dev_handle – Handle of the device to close

Raises:

ANC350LibError is raised, if the function call fails

discover(search_usb: bool = True, search_tcp: bool = True) int[source]

Discover Devices

The function searches for connected ANC350RES devices on USB and LAN and initializes internal data structures per device. Devices that arwe in use by another application or PC are not found. The function must be called before connecting to a device and must not be called as long as any devices are connected.

The number of devices found is returned. In subsequent functions, devices are identified by a sequence number that must be less than the number returned.

Parameters:
  • search_usb – True (default) to search for USB devices; False otherwise

  • search_tcp – True (default) to search for TCP/IP devices; False otherwise

Returns:

Number of devices found

Raises:

ANC350LibError is raised, if the function call fails

enable_ref_auto_reset(dev_handle: c_void_p, axis_no: int, enable: bool) None[source]

Enable Position Auto Reset

Enables or disables the position auto reset for an axis. When enabled, every time the reference marking is hit, the position will be set to zero. When disabled, the reference marking will be ignored. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) the feature

Raises:

ANC350LibError is raised, if the function call fails

enable_ref_auto_update(dev_handle: c_void_p, axis_no: int, enable: bool) None[source]

Enable Reference Auto Update

Enables or disables the reference auto update for an axis. When enabled, every time the reference marking is hit, the reference position will be updated. When disabled, the reference marking will be considered only the first time, later hits will be ignored. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enable (True) or disable (False) the feature

Raises:

ANC350LibError is raised, if the function call fails

enable_sensor(dev_handle: c_void_p, enable: bool) None[source]

Switch Sensor Power

Switches the sensor power for all axes on or off. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • enable – Enable (True) or disable (False) the sensor

Raises:

ANC350LibError is raised, if the function call fails

get_actuator_name(dev_handle: c_void_p, axis_no: int) str[source]

Get Actuator Name

Get the name of the currently selected actuator

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Name of the actuator

Raises:

ANC350LibError is raised, if the function call fails

get_actuator_type(dev_handle: c_void_p, axis_no: int) ANC350LibActuatorType[source]

Get Actuator Type

Get the type of the currently selected actuator

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Type of the actuator

Raises:

ANC350LibError is raised, if the function call fails

get_amplitude(dev_handle: c_void_p, axis_no: int) float[source]

Read Back Amplitude

Reads back the amplitude parameter of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Amplitude in Volts [V]

Raises:

ANC350LibError is raised, if the function call fails

get_axis_status(dev_handle: c_void_p, axis_no: int) Tuple[bool, bool, bool, bool, bool, bool, bool][source]

Read Axis Status

Reads status information about an axis of the device.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

  1. connected: True, if the axis is connected to a sensor.

  2. enabled: True, if the axis voltage output is enabled.

  3. moving: True, if the axis is moving.

  4. target: True, if the target is reached in automatic positioning.

  5. eot_fwd: True, if end of travel detected in forward direction.

  6. eot_bwd: True, if end of travel detected in backward direction.

  7. error: True, if the axis’ sensor is in error state.

Return type:

A tuple containing the axis status

Raises:

ANC350LibError is raised, if the function call fails

get_device_config(dev_handle: c_void_p) Tuple[bool, bool, bool, bool][source]

Read Device Configuration

Reads static device configuration data

Parameters:

dev_handle – Handle of the device to access

Returns:

  1. sync: Ethernet enabled (True) or disabled (False)

  2. lockin: Low power loss measurement enabled (True) or disabled (False)

  3. duty: Duty cycle enabled (True) or disabled (False)

  4. app: Control by iOS app enabled (True) or disabled (False)

Return type:

A tuple containing which features of the device are enabled

Raises:

ANC350LibError is raised, if the function call fails

get_device_info(dev_no: int = 0) Tuple[ANC350LibDeviceType, int, str, str, bool][source]

Device Information

Returns available information about a device. The function can not be called before discover but the devices don’t have to be connected with connect. All Pointers to output parameters may be zero to ignore the respective value.

Parameters:

dev_no – Sequence number of the device. Must be smaller than the return value from the last ANC_discover call (default: 0).

Returns:

  1. dev_type: Type of the ANC350 device

  2. id: Programmed hardware ID of the device

  3. serial: The device’s serial number

  4. address: The device’s interface address if applicable. Returns the IP address in

    dotted-decimal notation or the string “USB”, respectively

  5. connected: True, if the device is already connected

Return type:

A tuple containing the device’s information

Raises:

ANC350LibError is raised, if the function call fails

get_firmware_version(dev_handle: c_void_p) int[source]

Firmware version

Retrieves the version of currently loaded firmware.

Parameters:

dev_handle – Handle of the device to access

Returns:

Version number

Raises:

ANC350LibError is raised, if the function call fails

get_frequency(dev_handle: c_void_p, axis_no: int) float[source]

Read back Frequency

Reads back the frequency parameter of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Frequency in Hertz [Hz]

Raises:

ANC350LibError is raised, if the function call fails

get_position(dev_handle: c_void_p, axis_no: int) float[source]

Read Current Position

Retrieves the current actuator position. For linear type actuators the position unit is m; for goniometers and rotators it is degree.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Current position in meters [m] or degrees [°]

Raises:

ANC350LibError is raised, if the function call fails

get_ref_position(dev_handle: c_void_p, axis_no: int) Tuple[float, bool][source]

Read Reference Position

Retrieves the current reference position. For linear type actuators the position unit is meter [m]; for goniometers and rotators it is degree [°]. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

  1. position: Current reference position in meters [m] or degrees [°].

  2. valid: True, if the reference position is valid.

Return type:

Tuple containing the reference position

Raises:

ANC350LibError is raised, if the function call fails

measure_capacitance(dev_handle: c_void_p, axis_no: int) float[source]

Measure Motor Capacitance

Performs a measurement of the capacitance of the piezo motor and returns the result. If no motor is connected, the result will be 0. The function doesn’t return before the measurement is complete; this will take a few seconds of time.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Capacitance in Farad [F]

Raises:

ANC350LibError is raised, if the function call fails

move_reference(dev_handle: c_void_p, axis_no: int) None[source]

Reset Reference

Starts an approach to the reference position. A running motion command is aborted; automatic moving (see start_auto_move) is switched on. Requires a valid reference position. Only applicable for NUM devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

reset_position(dev_handle: c_void_p, axis_no: int) None[source]

Reset Position

Sets the current (relative) position of an axis to Zero. Only applicable for NUM and FPS devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Raises:

ANC350LibError is raised, if the function call fails

save_params(dev_handle: c_void_p) None[source]

Save Parameters

Saves parameters to persistent flash memory in the device. They will be present as defaults after the next power-on. The following parameters are affected: * amplitude (see set_amplitude) * frequency (see set_frequency) * target range (see set_target_range) * target ground (see set_target_ground) * actuator selection (see select_actuator) * trigger and quadrature settings

Parameters:

dev_handle – Handle of the device to access

Raises:

ANC350LibError is raised, if the function call fails

select_actuator(dev_handle: c_void_p, axis_no: int, actuator: int) None[source]

Select Actuator

Selects the actuator to be used for the axis from actuator presets.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • actuator – Actuator selection (0..255)

Raises:

ANC350LibError is raised, if the function call fails

set_amplitude(dev_handle: c_void_p, axis_no: int, amplitude: float) None[source]

Set Amplitude

Sets the amplitude parameter for an axis

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • amplitude – Amplitude in Volts [V] (internal resolution is 1mV)

Raises:

ANC350LibError is raised, if the function call fails

set_axis_output(dev_handle: c_void_p, axis_no: int, enable: bool, auto_disable: bool) None[source]

Enable Axis Output

Enables or disables the voltage output of an axis.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – True, to enable the voltage output. False, to disable it.

  • auto_disable – True, if the voltage output is to be deactivated automatically when end of travel is detected.

Raises:

ANC350LibError is raised, if the function call fails

set_dc_voltage(dev_handle: c_void_p, axis_no: int, voltage: float) None[source]

Set DC Output Voltage

Sets the DC level on the voltage output when no sawtooth based motion and no feedback loop is active.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • voltage – DC output voltage in Volts [V], internal resolution is 1 mV

Raises:

ANC350LibError is raised, if the function call fails

set_frequency(dev_handle: c_void_p, axis_no: int, frequency: float) None[source]

Set Frequency

Sets the frequency parameter for an axis

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • frequency – Frequency in Hertz [Hz], internal resolution is 1 Hz (although DLL accepts double-values)

Raises:

ANC350LibError is raised, if the function call fails

set_target_position(dev_handle: c_void_p, axis_no: int, target: float) None[source]

Set Target Position

Sets the target position for automatic motion, see start_auto_move. For linear type actuators the position unit is m, for goniometers and rotators it is degree.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target – Target position in meters [m] or degrees [°]. Internal resolution is 1 nm or 1 µ°.

Raises:

ANC350LibError is raised, if the function call fails

set_target_range(dev_handle: c_void_p, axis_no: int, target_range: float) None[source]

Set Target Range

Defines the range around the target position where the target is considered to be reached.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target_range – Target range in meters [m] or degrees [°]. Internal resolution is 1 nm or 1 µ°.

Raises:

ANC350LibError is raised, if the function call fails

start_auto_move(dev_handle: c_void_p, axis_no: int, enable: bool, relative: bool) None[source]

Set Automatic Motion

Switches automatic moving (i.e. following the target position) on or off

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • enable – Enables (True) or disables (False) automatic motion

  • relative – If the target position is to be interpreted absolute (False) or relative to the current position (True)

Raises:

ANC350LibError is raised, if the function call fails

start_continuous_move(dev_handle: c_void_p, axis_no: int, start: bool, backward: bool) None[source]

Continuous Motion

Starts or stops continous motion in forward or backward direction. Other kinds of motion are stopped.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • start – Starts (True) or stops (False) the motion

  • backward – Step direction forward (False) or backward (True)

Raises:

ANC350LibError is raised, if the function call fails

start_single_step(dev_handle: c_void_p, axis_no: int, backward: bool) None[source]

Single Step

Triggers a single step in desired direction.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • backward – Step direction forward (False) or backward (True)

Raises:

ANC350LibError is raised, if the function call fails

DEFAULT_PATH_TO_DLL = 'anc350v3.dll'
class qcodes_contrib_drivers.drivers.Attocube.ANC350Lib.ANC350v4Lib(path_to_dll: str | None = None)[source]

Bases: ANC350v3Lib

A wrapper class for version 4 of the ANC350 driver anc350v4.dll

This class adapts all functions of anc350v4.dll and forwards its calls to the dll. ANC350v4Lib is backwards compatible to ANC350v3Lib; version 4 only has some more functions.

__init__(path_to_dll: str | None = None)[source]

Creates an instance of the anc350v4.dll-wrapper

Parameters:

path_to_dll – Path to anc350v4.dll or None, if it’s stored in the working directory

get_dc_voltage(dev_handle: c_void_p, axis_no: int) float[source]

Read back DC Output Voltage

Reads back the current DC level. It may be the level that has been set by set_dc_voltag or the value currently adjusted by the feedback controller.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

DC output voltage in Volts [V]

Raises:

ANC350LibError is raised, if the function call fails

get_lut_name(dev_handle: c_void_p, axis_no: int) str[source]

Get LUT Name

Get the name of the currently selected sensor look-up table. The function is only available in RES devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

Returns:

Name of the look-up table.

Raises:

ANC350LibError is raised, if the function call fails

load_lut_file(dev_handle: c_void_p, axis_no: int, file_name: str) None[source]

Load Lookup Table

Loads a sensor lookup table from a file into the device. The function is only available in RES devices.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • file_name – Name of the LUT file to read, optionally with path.

Raises:

ANC350LibError is raised, if the function call fails

register_external_ip(hostname: str) bool[source]

Register IP Device in external Network

discover is able to find devices connected via TCP/IP in the same network segment, but it can’t “look through” routers. To connect devices in external networks, reachable by routing, the IP addresses of those devices have to be registered prior to calling discover. The function registers one device and can be called several times.

The function will return True, if the name resolution succeeds (False otherwise); it doesn’t test if the device is reachable. Registered and reachable devices will be found by discover.

Parameters:

hostname – Hostname or IP Address in dotted decimal notation of the device to register.

Returns:

True, if the name resolution succeeds. This doesn’t guarantee that the device is reachable. False, if the hostname couldn’t be resolved.

Raises:

ANC350LibError is raised, if the function call fails

set_target_ground(dev_handle: c_void_p, axis_no: int, target_ground: bool) None[source]

Set Target Ground Flag

Sets or clears the Target Ground Flag. It determines the action performed in automatic positioning mode when the target position is reached. If set, the DC output is set to 0V and the position control feedback loop is stopped.

Parameters:
  • dev_handle – Handle of the device to access

  • axis_no – Axis number (0..2)

  • target_ground – Target Ground Flag

Raises:

ANC350LibError is raised, if the function call fails

DEFAULT_PATH_TO_DLL = 'anc350v4.dll'