pylablib.devices.PhysikInstrumente package¶
Submodules¶
pylablib.devices.PhysikInstrumente.base module¶
-
exception
pylablib.devices.PhysikInstrumente.base.
PhysikInstrumenteError
[source]¶ Bases:
pylablib.core.devio.base.DeviceError
Generic Physik Instrumente error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
pylablib.devices.PhysikInstrumente.base.
PhysikInstrumenteBackendError
(exc)[source]¶ Bases:
pylablib.devices.PhysikInstrumente.base.PhysikInstrumenteError
,pylablib.core.devio.comm_backend.DeviceBackendError
Generic Physik Instrumente backend communication error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
pylablib.devices.PhysikInstrumente.base.
GenericPIController
(conn, auto_online=True)[source]¶ Bases:
pylablib.core.devio.comm_backend.ICommBackendWrapper
,pylablib.devices.interface.stage.IMultiaxisStage
Generic Physik Instrumente controller.
Parameters: - conn – connection parameters (usually port or a tuple containing port and baudrate)
- auto_online – if
True
, switch to the online mode upon connection; in this online mode controller parameters are controlled remotely instead of the front panel (including external voltages), while in the offline mode most of the parameters are still controlled manually, and the remote connection is mostly used for readout
-
Error
¶ alias of
PhysikInstrumenteError
-
query
(comm, multiline=False, reply=True)[source]¶ Query a single command to the controller.
If
multiline==True
, expect a multi-line reply and return a list with separate reply lines; otherwise, expect a single-line reply and raise an error if multi-line reply is received.If
reply==False
, expect no reply at all (used for, e.g., set commands).
-
query_axis
(comm, axis=None, subidx=None, kind='str')[source]¶ Query the given command for the given axis.
axis can be a single axis name (e.g.,
"A"
), a list of axes, orNone
, which queries all axes. If axis is a single axis, simply return the corresponding value; otherwise, return a dict{axis: value}
. kind can specify value kind:"str"
(return as is),"float"
,"int"
, or"bool"
.
-
set_axis
(comm, value, axis=None, subidx=None, reply=False)[source]¶ Query the given value for the given axis.
value can be a single value (set the same for all specified axes), a list of values (one per axis), or a dict
{axis: value}
. axis can be a single axis name (e.g.,"A"
), a list of axes, orNone
, which queries all axes. Ifreply==False
, expect no reply.
-
get_help
()[source]¶ Get the help for all commands; might take a long time on low-speed serial connections
-
get_axis_parameter
(pid, axis=None, kind='str')[source]¶ Get value of the given parameter id for the given axis (all axes by default)
-
set_axis_parameter
(pid, value, axis=None, kind='str')[source]¶ Get value of the given parameter id for the given axis (all axes by default)
-
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)
-
class
pylablib.devices.PhysikInstrumente.base.
PIE516
(conn, auto_online=True)[source]¶ Bases:
pylablib.devices.PhysikInstrumente.base.GenericPIController
Physik Instrumente E-516 controller.
Parameters: - conn – serial connection parameters (usually port or a tuple containing port and baudrate)
- auto_online – if
True
, switch to the online mode upon connection; in this online mode controller parameters such as voltages or positions are controlled remotely instead of the front panel (including external voltages), while in the offline mode most of the parameters are still controlled manually, and the remote connection is mostly used for readout
-
is_servo_enabled
(axis=None)[source]¶ Check if the servo is enabled on the given axis (all axes by default)
-
enable_servo
(enable=True, axis=None)[source]¶ Enable or disable servo on the given axis (all axes by default)
-
is_drift_compensation_enabled
(axis=None)[source]¶ Check if the drift compensation is enabled on the given axis (all axes by default)
-
enable_drift_compensation
(enable=True, axis=None)[source]¶ Enable or disable drift compensation on the given axis (all axes by default)
-
is_velocity_control_enabled
(axis=None)[source]¶ Check if the velocity control is enabled on the given axis (all axes by default)
-
enable_velocity_control
(enable=True, axis=None)[source]¶ Enable or disable velocity control on the given axis (all axes by default)
-
get_voltage_setpoint
(axis=None)[source]¶ Get the current voltage setpoint on the given axis (all axes by default)
-
get_voltage
(axis=None)[source]¶ Get the actual voltage value on the given axis (all axes by default)
-
set_voltage
(voltage, axis=None)[source]¶ Get the target voltage on the given axis (all axes by default)
-
get_voltage_lower_limit
(axis=None)[source]¶ Get the lower output voltage limit on the given axis (all axes by default)
-
set_voltage_lower_limit
(voltage, axis=None)[source]¶ Get the lower output voltage limit on the given axis (all axes by default)
-
get_voltage_upper_limit
(axis=None)[source]¶ Get the upper output voltage limit on the given axis (all axes by default)
-
set_voltage_upper_limit
(voltage, axis=None)[source]¶ Get the upper output voltage limit on the given axis (all axes by default)
-
get_position_lower_limit
(axis=None)[source]¶ Get the lower position limit on the given axis (all axes by default)
-
set_position_lower_limit
(position, axis=None)[source]¶ Get the lower position limit on the given axis (all axes by default)
-
get_position_upper_limit
(axis=None)[source]¶ Get the upper position limit on the given axis (all axes by default)
-
set_position_upper_limit
(position, axis=None)[source]¶ Get the upper position limit on the given axis (all axes by default)
-
Error
¶ alias of
PhysikInstrumenteError
-
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
-
enable_online
(enable=True)¶ Enable or disable online mode
-
get_all_axes
()¶ Get the list of all available axes (taking mapping into account)
-
get_axis_parameter
(pid, axis=None, kind='str')¶ Get value of the given parameter id for the given axis (all axes by default)
-
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_help
()¶ Get the help for all commands; might take a long time on low-speed serial connections
-
get_id
()¶ Get the device ID string
-
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_online_enabled
()¶ Check if online mode is enabled
-
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
-
query
(comm, multiline=False, reply=True)¶ Query a single command to the controller.
If
multiline==True
, expect a multi-line reply and return a list with separate reply lines; otherwise, expect a single-line reply and raise an error if multi-line reply is received.If
reply==False
, expect no reply at all (used for, e.g., set commands).
-
query_axis
(comm, axis=None, subidx=None, kind='str')¶ Query the given command for the given axis.
axis can be a single axis name (e.g.,
"A"
), a list of axes, orNone
, which queries all axes. If axis is a single axis, simply return the corresponding value; otherwise, return a dict{axis: value}
. kind can specify value kind:"str"
(return as is),"float"
,"int"
, or"bool"
.
-
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_axis
(comm, value, axis=None, subidx=None, reply=False)¶ Query the given value for the given axis.
value can be a single value (set the same for all specified axes), a list of values (one per axis), or a dict
{axis: value}
. axis can be a single axis name (e.g.,"A"
), a list of axes, orNone
, which queries all axes. Ifreply==False
, expect no reply.
-
set_axis_parameter
(pid, value, axis=None, kind='str')¶ Get value of the given parameter id for the given axis (all axes by default)
-
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)