pylablib.devices.Newport package

Submodules

pylablib.devices.Newport.base module

exception pylablib.devices.Newport.base.NewportError[source]

Bases: pylablib.core.devio.base.DeviceError

Generic Newport device error

args
with_traceback()

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

exception pylablib.devices.Newport.base.NewportBackendError(exc)[source]

Bases: pylablib.devices.Newport.base.NewportError, pylablib.core.devio.comm_backend.DeviceBackendError

Newport backend communication error

args
with_traceback()

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

pylablib.devices.Newport.picomotor module

pylablib.devices.Newport.picomotor.get_usb_devices_number()[source]

Get the number of controllers connected via USB

pylablib.devices.Newport.picomotor.muxaddr(*args, **kwargs)[source]

Multiplex the function over its addr argument

class pylablib.devices.Newport.picomotor.TDeviceInfo(id)

Bases: tuple

count()

Return number of occurrences of value.

id
index()

Return first index of value.

Raises ValueError if the value is not present.

class pylablib.devices.Newport.picomotor.Picomotor8742(conn=0, backend='auto', timeout=5.0, multiaddr=False, scan=True)[source]

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

Picomotor 8742 4-axis controller.

Parameters:
  • conn – connection parameters; can be an index (starting from 0) for USB devices, or an IP address (e.g., "192.168.0.2") or host name (e.g., "8742-12345") for Ethernet devices
  • backend – communication backend; by default, try to determine from the communication parameters
  • timeout (float) – default operation timeout
  • multiaddr – if True, assume that there are several daisy-chained devices connected to the current one; in this case, get_device_info and related methods return dictionaries {addr: value} for all connected controllers instead of simply values for the given controller
  • scan – if True and multiaddr==True, scan for all connected devices (call scan_devices()) upon connection
Error

alias of pylablib.devices.Newport.base.NewportError

query(comm, axis=None, addr=None, read_reply=None)[source]
get_id(addr=None)[source]

Get the device identification string

get_device_info(addr=None)[source]

Get the device info of the controller board: (id_string,)

reset(addr=None)[source]

Restart the device.

Reboots the CPU and restores all saved settings from the parameter memory.

save_parameters(addr=None)[source]

Store current parameters to the non-volatile memory.

Affects axes speed and acceleration, motor types, and Ethernet parameters.

restore_parameters(src='memory', addr=None)[source]

Restore parameters from the non-volatile memory (if src=="memory") for factory parameters (if src=="factory").

Affects axes speed and acceleration, motor types, and Ethernet parameters.

scan_devices(reassign='conflict', sync=True)[source]

Scan for devices connected to the current host device via RS-485 daisy-chaining.

reassign controls how device addresses are assigned during the scan; can be "none" (keep current values; can lead to conflicts if several devices have the same address), "conflict" (change conflicting addresses), or "all" (assigned all new addresses in sequence starting from the host)

If sync==True, wait until the scan is done (might take several seconds).

get_addr_map()[source]

Get address map for devices connected to the current host device via RS-485 daisy-chaining.

Return tuple (addresses, conflict), where addresses is the list of all device addresses, and conflict==True if there address conflicts (several devices having the same address).

wait_for_scan(timeout=10.0)[source]

Wait for the device connection scan to finish

get_addr(addr=None)[source]

Get RS-485 address of the given device (host if addr is None)

set_addr(new_addr, addr=None)[source]

Set RS-485 address of the given device (host if addr is None)

get_ethernet_parameters(addr=None)[source]

Get Ethernet connection parameters.

Return tuple (hostname, ipaddr, ipmode, gateway, netmask).

setup_ethernet(hostname=None, ipmode=None, ipaddr=None, gateway=None, netmask=None, addr=None)[source]

Setup Ethernet connection parameters.

Any None value remains unchanged. Note that these settings only take effect after saving parameters to the memory (save_parameters()) and restarting the device (reset()). If the connection is made through Ethernet, then it will likely be invalidated, in which case a new device object with the updated parameters should be created after reset.

autodetect_motors(addr=None)[source]

Autodetect connected motors.

The command involves sending single-step commands to the motors, so it requires all axes to be stopped, and it might slightly affect the current position. After the detection the types can be stored in the memory via save_parameters().

get_motor_type(axis='all', addr=None)[source]

Get type of the given axis motor

set_motor_type(axis='all', motor_type='standard', addr=None)[source]

Manually set type of the given axis motor

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

Move to a given position

move_by(axis, steps=1, addr=None)[source]

Move by a given number of steps

get_position(axis='all', addr=None)[source]

Get the current axis position

set_position_reference(axis, position=0, addr=None)[source]

Set the current axis position as a reference (the actual motor position stays the same)

jog(axis, direction, addr=0)[source]

Jog a given axis in a given direction.

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

is_moving(axis='all', addr=None)[source]

Check if the axis is moving

wait_move(axis='all', addr=None)[source]

Wait until axis motion is done

stop(axis='all', immediate=False, addr=None)[source]

Stop motion of a given axis.

If immediate==True make an abrupt stop; otherwise, slow down gradually. Note that immediate stop has to stop all axes simultaneously, so it only takes axis=="all".

get_velocity_parameters(axis='all', addr=None)[source]

Return velocity parameters (speed, accel) for the given axis and controller.

speed and accel denote, correspondingly, maximal (i.e., steady regime) moving speed and acceleration in steps/s and steps/s^2.

setup_velocity(axis='all', speed=None, accel=None, addr=None)[source]

Setup velocity parameters (speed, accel) for the given axis and controller.

speed and accel denote, correspondingly, maximal (i.e., steady regime) moving speed and acceleration in steps/s and steps/s^2. None values are left unchanged.

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)

Module contents