pylablib.devices.Newport package
Submodules
pylablib.devices.Newport.base module
- exception pylablib.devices.Newport.base.NewportError[source]
Bases:
DeviceError
Generic Newport device error
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception pylablib.devices.Newport.base.NewportBackendError(exc)[source]
Bases:
NewportError
,DeviceBackendError
Newport backend communication error
- add_note()
Exception.add_note(note) – add a note to the exception
- 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.Picomotor8742(conn=0, backend='auto', timeout=5.0, multiaddr=False, scan=True)[source]
Bases:
ICommBackendWrapper
,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 devicesbackend – 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 controllerscan – if
True
andmultiaddr==True
, scan for all connected devices (callscan_devices()
) upon connection
- Error
alias of
NewportError
- 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 (ifsrc=="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)
, whereaddresses
is the list of all device addresses, andconflict==True
if there address conflicts (several devices having the same address).
- 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()
.
- set_motor_type(axis='all', motor_type='standard', addr=None)[source]
Manually set type of the given axis motor
- 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.
- 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 takesaxis=="all"
.
- get_velocity_parameters(axis='all', addr=None)[source]
Return velocity parameters
(speed, accel)
for the given axis and controller.speed
andaccel
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
andaccel
denote, correspondingly, maximal (i.e., steady regime) moving speed and acceleration in steps/s and steps/s^2.None
values are left unchanged.
- 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)