pnpq.devices package#
Submodules#
pnpq.devices.odl_ozoptics_650ml module#
- class pnpq.devices.odl_ozoptics_650ml.OdlOzOptics(serial_port=None, serial_number=None)#
Bases:
OpticalDelayLine
- Parameters:
serial_port (str | None)
serial_number (str | None)
- connect()#
- Return type:
None
- echo(on_off)#
- Parameters:
on_off (int)
- Return type:
str
- forward()#
- Return type:
str
- get_device_info()#
- Return type:
tuple[str, str]
- get_mfg_date()#
- Return type:
str
- get_serial()#
- Return type:
str
- get_step()#
- Return type:
int
- home()#
- Return type:
str
- move(dist)#
- Parameters:
dist (float)
- Return type:
None
- oz_mode(on_off)#
- Parameters:
on_off (int)
- Return type:
str
- read_key(key, retries=5)#
- Parameters:
key (str)
retries (int)
- Return type:
str
- readall()#
- Return type:
tuple[bool, str]
- reset()#
- Return type:
str
- resolution#
32768 steps per motor revolution(5.08 mm = 2xDistance Travel or mirror travel per pitch 0.1 inch)
- reverse()#
- Return type:
str
- serial_close()#
- Return type:
None
- serial_command(serial_cmd)#
- Parameters:
serial_cmd (str)
- Return type:
str
- serial_read()#
- Return type:
str
- serial_send(serial_cmd)#
- Parameters:
serial_cmd (str)
- Return type:
None
- set_step(value)#
- Parameters:
value (int)
- Return type:
str
- start_burn_in(parameter)#
- Parameters:
parameter (int)
- Return type:
str
- stop()#
- Return type:
str
- write_hw_version(parameter)#
- Parameters:
parameter (int)
- Return type:
str
- write_mfg_date(parameter)#
- Parameters:
parameter (int)
- Return type:
str
- write_name(parameter)#
- Parameters:
parameter (int)
- Return type:
str
- write_serial(parameter)#
- Parameters:
parameter (int)
- Return type:
str
- write_to_flash()#
- Return type:
str
pnpq.devices.odl_thorlabs_kbd101 module#
- class pnpq.devices.odl_thorlabs_kbd101.AbstractOpticalDelayLineThorlabsKBD101#
Bases:
ABC
- abstractmethod get_homeparams()#
Request home parameters from the device.
- Return type:
- abstractmethod get_jogparams()#
Request jog parameters from the device.
- Return type:
- abstractmethod get_status()#
Request the latest status message from the device.
- Return type:
- abstractmethod get_velparams()#
Request velocity parameters from the device.
- Return type:
- abstractmethod home()#
Move the device to home position.
- Return type:
None
- abstractmethod identify()#
Identifies the device represented by this instance by flashing the light on the device.
- Parameters:
chan_ident – The motor channel to identify.
- Return type:
None
- abstractmethod jog(jog_direction)#
Jog the device in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- abstractmethod move_absolute(position)#
Move the device to the specified position.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- abstractmethod set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (None | HomeDirection) – The home direction.
limit_switch (None | LimitSwitch) – The limit switch.
home_velocity (None | Quantity) – The home velocity.
offset_distance (None | Quantity) – The offset distance.
- Return type:
None
- abstractmethod set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (JogMode | None) – The jog mode.
jog_step_size (Quantity | None) – The jog step size.
jog_minimum_velocity (Quantity | None) – The minimum velocity.
jog_acceleration (Quantity | None) – The acceleration.
jog_maximum_velocity (Quantity | None) – The maximum velocity.
jog_stop_mode (StopMode | None) – The stop mode.
- Return type:
None
- abstractmethod set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- class pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineHomeParams(*args, **kwargs)#
Bases:
UserDict
[str
,Any
]- Parameters:
args (Any)
kwargs (Any)
- class pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineJogParams(*args, **kwargs)#
Bases:
UserDict
[str
,Any
]- Parameters:
args (Any)
kwargs (Any)
- class pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineThorlabsKBD101(*, connection: pnpq.apt.connection.AbstractAptConnection, home_on_init: bool = True)#
Bases:
AbstractOpticalDelayLineThorlabsKBD101
- Parameters:
connection (AbstractAptConnection)
home_on_init (bool)
- connection: AbstractAptConnection#
- get_homeparams()#
Request home parameters from the device.
- Return type:
- get_jogparams()#
Request jog parameters from the device.
- Return type:
- get_status()#
Request the latest status message from the device.
- Return type:
- get_velparams()#
Request velocity parameters from the device.
- Return type:
- home()#
Move the device to home position.
- Return type:
None
- home_on_init: bool = True#
- identify()#
Identifies the device represented by this instance by flashing the light on the device.
- Parameters:
chan_ident – The motor channel to identify.
- Return type:
None
- jog(jog_direction)#
Jog the device in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(position)#
Move the device to the specified position.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- set_channel_enabled(enabled)#
- Parameters:
enabled (bool)
- Return type:
None
- set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (None | HomeDirection) – The home direction.
limit_switch (None | LimitSwitch) – The limit switch.
home_velocity (None | Quantity) – The home velocity.
offset_distance (None | Quantity) – The offset distance.
- Return type:
None
- set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (JogMode | None) – The jog mode.
jog_step_size (Quantity | None) – The jog step size.
jog_minimum_velocity (Quantity | None) – The minimum velocity.
jog_acceleration (Quantity | None) – The acceleration.
jog_maximum_velocity (Quantity | None) – The maximum velocity.
jog_stop_mode (StopMode | None) – The stop mode.
- Return type:
None
- set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- class pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineVelocityParams(*args, **kwargs)#
Bases:
UserDict
[str
,Any
]- Parameters:
args (Any)
kwargs (Any)
pnpq.devices.odl_thorlabs_kbd101_stub module#
- class pnpq.devices.odl_thorlabs_kbd101_stub.OpticalDelayLineThorlabsKBD101Stub(*, time_scaling_factor: float = 0.0, current_velocity_params: pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineVelocityParams = <factory>, current_home_params: pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineHomeParams = <factory>, current_jog_params: pnpq.devices.odl_thorlabs_kbd101.OpticalDelayLineJogParams = <factory>)#
Bases:
AbstractOpticalDelayLineThorlabsKBD101
- Parameters:
time_scaling_factor (float)
current_velocity_params (OpticalDelayLineVelocityParams)
current_home_params (OpticalDelayLineHomeParams)
current_jog_params (OpticalDelayLineJogParams)
- current_home_params: OpticalDelayLineHomeParams#
- current_jog_params: OpticalDelayLineJogParams#
- current_velocity_params: OpticalDelayLineVelocityParams#
- get_homeparams()#
Request home parameters from the device.
- Return type:
- get_jogparams()#
Request jog parameters from the device.
- Return type:
- get_status()#
Request the latest status message from the device.
- Return type:
- get_velparams()#
Request velocity parameters from the device.
- Return type:
- home()#
Move the device to home position.
- Return type:
None
- identify()#
Identifies the device represented by this instance by flashing the light on the device.
- Parameters:
chan_ident – The motor channel to identify.
- Return type:
None
- jog(jog_direction)#
Jog the device in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(position)#
Move the device to the specified position.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (HomeDirection | None) – The home direction.
limit_switch (LimitSwitch | None) – The limit switch.
home_velocity (Quantity | None) – The home velocity.
offset_distance (Quantity | None) – The offset distance.
- Return type:
None
- set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (JogMode | None) – The jog mode.
jog_step_size (Quantity | None) – The jog step size.
jog_minimum_velocity (Quantity | None) – The minimum velocity.
jog_acceleration (Quantity | None) – The acceleration.
jog_maximum_velocity (Quantity | None) – The maximum velocity.
jog_stop_mode (StopMode | None) – The stop mode.
- Return type:
None
- set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- time_scaling_factor: float = 0.0#
pnpq.devices.optical_delay_line module#
- class pnpq.devices.optical_delay_line.OpticalDelayLine(port=None, serial_number=None)#
Bases:
object
represents optical delay line devices. all ODL classes must inherit this class.
- Parameters:
port (str | None)
serial_number (str | None)
- conn: Serial#
represents a Serial connection
- device_sn: str | None#
device’s serial number
- name: str#
- port: str | None#
initialize ODL class
pnpq.devices.polarization_controller_thorlabs_mpc module#
- class pnpq.devices.polarization_controller_thorlabs_mpc.AbstractPolarizationControllerThorlabsMPC#
Bases:
ABC
- abstractmethod get_params()#
Get the parameters of the device represented by this instance.
- Returns:
The set of parameters in a dictionary defined in
PolarizationControllerParams
.- Return type:
- abstractmethod get_status(chan_ident)#
Fetch the status of a single channel.
- Parameters:
chan_ident (ChanIdent) – The motor channel to fetch status for.
- Returns:
The message returned by the device, in
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
- Return type:
- abstractmethod get_status_all()#
Fetch the latest status of all channels on the device.
- Returns:
A tuple of
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
, one for each channel.- Return type:
tuple[AptMessage_MGMSG_MOT_GET_USTATUSUPDATE, …]
- abstractmethod home(chan_ident)#
Move the device to home position.
The home position can be customized using the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to set to home.
- Return type:
None
- abstractmethod identify(chan_ident)#
Identifies the device represented by this instance by flashing the LED light on the device.
- Parameters:
chan_ident (ChanIdent) – The motor channel to identify.
- Return type:
None
- abstractmethod jog(chan_ident, jog_direction)#
Jogs the device forward or backwards in small steps. Experimentally, jog steps of 50 or greater seem to work the best.
The specific number of steps per jog can be set via the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to jog.
jog_direction (JogDirection) – The direction the paddle should move in.
- Return type:
None
- abstractmethod move_absolute(chan_ident, position)#
Move the device to an absolute position.
- Parameters:
chan_ident (ChanIdent) – The motor channel to move.
position (Quantity) – The angle to move the device. The unit must be in
mpc320_step
or in a compatible angle unit. The move position must be within 0 and 170 degrees (or equivalent).
- Return type:
None
- abstractmethod set_channel_enabled(chan_ident, enabled)#
Enables or disables the specified motor channel. End users will not typically use this command. Instead, commands that require a channel to be enabled will automatically enable the channel before executing, and disable the channel when complete.
- Parameters:
chan_ident (ChanIdent) – The motor channel to enable.
enabled (bool) – Set to
True
to enable the channel, orFalse
to disable.
- Return type:
None
- abstractmethod set_params(velocity=None, home_position=None, jog_step_1=None, jog_step_2=None, jog_step_3=None)#
Update the parameters of the device.
All parameters of this function are optional. Only fields with values are updated on the device.
- Parameters:
velocity (None | Quantity) – The rotational velocity. Applies to all channels. Unit must be convertible to
mpc320_velocity
.home_position (None | Quantity) – The position where the device will move to when the
home()
function is called. Unit must be convertible tompc320_step
.jog_step_1 (None | Quantity) – The amount which the jog function will move for channel 1. Unit must be convertible to
mpc320_step
.jog_step_2 (None | Quantity) – The amount which the jog function will move for channel 2. Unit must be convertible to
mpc320_step
.jog_step_3 (None | Quantity) – The amount which the jog function will move for channel 3. Unit must be convertible to
mpc320_step
.
- Return type:
None
- class pnpq.devices.polarization_controller_thorlabs_mpc.PolarizationControllerParams(*args, **kwargs)#
Bases:
UserDict
[str
,Quantity
]- Parameters:
args (Any)
kwargs (Any)
- class pnpq.devices.polarization_controller_thorlabs_mpc.PolarizationControllerThorlabsMPC(*, connection: pnpq.apt.connection.AbstractAptConnection, available_channels: frozenset[pnpq.apt.protocol.ChanIdent] = frozenset())#
Bases:
AbstractPolarizationControllerThorlabsMPC
- Parameters:
connection (AbstractAptConnection)
available_channels (frozenset[ChanIdent])
- connection: AbstractAptConnection#
- get_params()#
Get the parameters of the device represented by this instance.
- Returns:
The set of parameters in a dictionary defined in
PolarizationControllerParams
.- Return type:
- get_status(chan_ident)#
Fetch the status of a single channel.
- Parameters:
chan_ident (ChanIdent) – The motor channel to fetch status for.
- Returns:
The message returned by the device, in
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
- Return type:
- get_status_all()#
Fetch the latest status of all channels on the device.
- Returns:
A tuple of
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
, one for each channel.- Return type:
tuple[AptMessage_MGMSG_MOT_GET_USTATUSUPDATE, …]
- home(chan_ident)#
Move the device to home position.
The home position can be customized using the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to set to home.
- Return type:
None
- identify(chan_ident)#
Identifies the device represented by this instance by flashing the LED light on the device.
- Parameters:
chan_ident (ChanIdent) – The motor channel to identify.
- Return type:
None
- jog(chan_ident, jog_direction)#
Jogs the device forward or backwards in small steps. Experimentally, jog steps of 50 or greater seem to work the best.
The specific number of steps per jog can be set via the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to jog.
jog_direction (JogDirection) – The direction the paddle should move in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(chan_ident, position)#
Move the device to an absolute position.
- Parameters:
chan_ident (ChanIdent) – The motor channel to move.
position (Quantity) – The angle to move the device. The unit must be in
mpc320_step
or in a compatible angle unit. The move position must be within 0 and 170 degrees (or equivalent).
- Return type:
None
- set_channel_enabled(chan_ident, enabled)#
Enables or disables the specified motor channel. End users will not typically use this command. Instead, commands that require a channel to be enabled will automatically enable the channel before executing, and disable the channel when complete.
- Parameters:
chan_ident (ChanIdent) – The motor channel to enable.
enabled (bool) – Set to
True
to enable the channel, orFalse
to disable.
- Return type:
None
- set_params(velocity=None, home_position=None, jog_step_1=None, jog_step_2=None, jog_step_3=None)#
Update the parameters of the device.
All parameters of this function are optional. Only fields with values are updated on the device.
- Parameters:
velocity (None | Quantity) – The rotational velocity. Applies to all channels. Unit must be convertible to
mpc320_velocity
.home_position (None | Quantity) – The position where the device will move to when the
home()
function is called. Unit must be convertible tompc320_step
.jog_step_1 (None | Quantity) – The amount which the jog function will move for channel 1. Unit must be convertible to
mpc320_step
.jog_step_2 (None | Quantity) – The amount which the jog function will move for channel 2. Unit must be convertible to
mpc320_step
.jog_step_3 (None | Quantity) – The amount which the jog function will move for channel 3. Unit must be convertible to
mpc320_step
.
- Return type:
None
- class pnpq.devices.polarization_controller_thorlabs_mpc.PolarizationControllerThorlabsMPC220(*, connection: pnpq.apt.connection.AbstractAptConnection, available_channels: frozenset[pnpq.apt.protocol.ChanIdent] = frozenset({<ChanIdent.CHANNEL_1: 1>, <ChanIdent.CHANNEL_2: 2>}))#
Bases:
PolarizationControllerThorlabsMPC
- Parameters:
connection (AbstractAptConnection)
available_channels (frozenset[ChanIdent])
- class pnpq.devices.polarization_controller_thorlabs_mpc.PolarizationControllerThorlabsMPC320(*, connection: pnpq.apt.connection.AbstractAptConnection, available_channels: frozenset[pnpq.apt.protocol.ChanIdent] = frozenset({<ChanIdent.CHANNEL_1: 1>, <ChanIdent.CHANNEL_2: 2>, <ChanIdent.CHANNEL_3: 4>}))#
Bases:
PolarizationControllerThorlabsMPC
- Parameters:
connection (AbstractAptConnection)
available_channels (frozenset[ChanIdent])
pnpq.devices.polarization_controller_thorlabs_mpc_stub module#
- class pnpq.devices.polarization_controller_thorlabs_mpc_stub.PolarizationControllerThorlabsMPC320Stub(*, time_scaling_factor: float = 0.0, available_channels: frozenset[pnpq.apt.protocol.ChanIdent] = frozenset({<ChanIdent.CHANNEL_1: 1>, <ChanIdent.CHANNEL_2: 2>, <ChanIdent.CHANNEL_3: 4>}), current_params: pnpq.devices.polarization_controller_thorlabs_mpc.PolarizationControllerParams = <factory>)#
Bases:
AbstractPolarizationControllerThorlabsMPC
- Parameters:
time_scaling_factor (float)
available_channels (frozenset[ChanIdent])
current_params (PolarizationControllerParams)
- available_channels: frozenset[ChanIdent] = frozenset({<ChanIdent.CHANNEL_1: 1>, <ChanIdent.CHANNEL_2: 2>, <ChanIdent.CHANNEL_3: 4>})#
- current_params: PolarizationControllerParams#
- get_params()#
Get the parameters of the device represented by this instance.
- Returns:
The set of parameters in a dictionary defined in
PolarizationControllerParams
.- Return type:
- get_status(chan_ident)#
Fetch the status of a single channel.
- Parameters:
chan_ident (ChanIdent) – The motor channel to fetch status for.
- Returns:
The message returned by the device, in
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
- Return type:
- get_status_all()#
Fetch the latest status of all channels on the device.
- Returns:
A tuple of
AptMessage_MGMSG_MOT_GET_USTATUSUPDATE
, one for each channel.- Return type:
tuple[AptMessage_MGMSG_MOT_GET_USTATUSUPDATE, …]
- home(chan_ident)#
Move the device to home position.
The home position can be customized using the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to set to home.
- Return type:
None
- identify(chan_ident)#
Identifies the device represented by this instance by flashing the LED light on the device.
- Parameters:
chan_ident (ChanIdent) – The motor channel to identify.
- Return type:
None
- jog(chan_ident, jog_direction)#
Jogs the device forward or backwards in small steps. Experimentally, jog steps of 50 or greater seem to work the best.
The specific number of steps per jog can be set via the
set_params()
function.- Parameters:
chan_ident (ChanIdent) – The motor channel to jog.
jog_direction (JogDirection) – The direction the paddle should move in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(chan_ident, position)#
Move the device to an absolute position.
- Parameters:
chan_ident (ChanIdent) – The motor channel to move.
position (Quantity) – The angle to move the device. The unit must be in
mpc320_step
or in a compatible angle unit. The move position must be within 0 and 170 degrees (or equivalent).
- Return type:
None
- set_channel_enabled(chan_ident, enabled)#
Enables or disables the specified motor channel. End users will not typically use this command. Instead, commands that require a channel to be enabled will automatically enable the channel before executing, and disable the channel when complete.
- Parameters:
chan_ident (ChanIdent) – The motor channel to enable.
enabled (bool) – Set to
True
to enable the channel, orFalse
to disable.
- Return type:
None
- set_params(velocity=None, home_position=None, jog_step_1=None, jog_step_2=None, jog_step_3=None)#
Update the parameters of the device.
All parameters of this function are optional. Only fields with values are updated on the device.
- Parameters:
velocity (None | Quantity) – The rotational velocity. Applies to all channels. Unit must be convertible to
mpc320_velocity
.home_position (None | Quantity) – The position where the device will move to when the
home()
function is called. Unit must be convertible tompc320_step
.jog_step_1 (None | Quantity) – The amount which the jog function will move for channel 1. Unit must be convertible to
mpc320_step
.jog_step_2 (None | Quantity) – The amount which the jog function will move for channel 2. Unit must be convertible to
mpc320_step
.jog_step_3 (None | Quantity) – The amount which the jog function will move for channel 3. Unit must be convertible to
mpc320_step
.
- Return type:
None
- time_scaling_factor: float = 0.0#
pnpq.devices.switch_stub module#
- class pnpq.devices.switch_stub.Switch#
Bases:
object
Stub Switch Device Class
- bar_state()#
Sets the optical switch’s state to 1 (bar state)
- Return type:
None
- connect()#
Establish connection to the device
- Return type:
None
- cross()#
Sets the optical switch’s state to 2 (cross state)
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
pnpq.devices.switch_thorlabs_osw_e module#
- class pnpq.devices.switch_thorlabs_osw_e.AbstractOpticalSwitchThorlabsE#
Bases:
ABC
Provides a thread-safe and blocking API for interacting with the Thorlabs OSWxx-yyyyE series of optical switches. This driver has been tested on the OSW22-1310E.
- abstractmethod close()#
Close the serial connection to the switch.
- Return type:
None
- abstractmethod get_board_name()#
Get the name and the firmware version of the switch.
- Returns:
The name and firmware version of the switch in string.
- Return type:
str
- abstractmethod get_query_type()#
Get the OSW board type code according to the configuration table.
- Returns:
The OSW board type code in string.
- Return type:
str
- abstractmethod get_state()#
Get the current state of the switch.
- abstractmethod open()#
Open the serial connection to the switch.
- Return type:
None
- class pnpq.devices.switch_thorlabs_osw_e.OpticalSwitchThorlabsE(*, serial_number: str, baudrate: int = 115200, bytesize: int = 8, exclusive: bool = True, parity: str = 'N', rtscts: bool = True, stopbits: int = 1, timeout: None | int = None)#
Bases:
AbstractOpticalSwitchThorlabsE
- Parameters:
serial_number (str)
baudrate (int)
bytesize (int)
exclusive (bool)
parity (str)
rtscts (bool)
stopbits (int)
timeout (None | int)
- baudrate: int = 115200#
- bytesize: int = 8#
- close()#
Close the serial connection to the switch.
- Return type:
None
- exclusive: bool = True#
- get_board_name()#
Get the name and the firmware version of the switch.
- Returns:
The name and firmware version of the switch in string.
- Return type:
str
- get_query_type()#
Get the OSW board type code according to the configuration table.
- Returns:
The OSW board type code in string.
- Return type:
str
- get_state()#
Get the current state of the switch.
- open()#
Open the serial connection to the switch.
- Return type:
None
- parity: str = 'N'#
- rtscts: bool = True#
- serial_number: str#
- set_state(state)#
Set the switch to the specified state. This function is idempotent; if the switch is already in the desired state, setting it to the same state again will not cause an error.
- stopbits: int = 1#
- timeout: None | int = None#
pnpq.devices.utils module#
- exception pnpq.devices.utils.TimeoutException#
Bases:
Exception
- pnpq.devices.utils.check_usb_hub_connected()#
- Return type:
bool
- pnpq.devices.utils.get_available_port(device_serial_number)#
- Parameters:
device_serial_number (str)
- Return type:
str | None
- pnpq.devices.utils.timeout(timeout_seconds)#
Context manager that yields a function that returns True if the timeout has not been exceeded and throws TimeoutException otherwise, making it suitable for use in loops.
timeout_seconds: float length of timeout, in seconds
- Parameters:
timeout_seconds (float)
- Return type:
Iterator[Callable[[], bool]]
pnpq.devices.waveplate_thorlabs_k10cr1 module#
- class pnpq.devices.waveplate_thorlabs_k10cr1.AbstractWaveplateThorlabsK10CR1#
Bases:
ABC
- abstractmethod get_homeparams()#
Request home parameters from the device.
- Return type:
- abstractmethod get_jogparams()#
Request jog parameters from the device.
- Return type:
- abstractmethod get_velparams()#
Request velocity parameters from the device.
- Return type:
- abstractmethod home()#
Move the waveplate to its home position.
- Return type:
None
- abstractmethod identify()#
Identify the device by blinking its LED.
- Return type:
None
- abstractmethod is_homed()#
Check if the device is homed. Sends the REQ_STATUSUPDATE message and checks the HOMED status bit.
Returns True if the device is homed, False otherwise.
- Return type:
bool
- abstractmethod jog(jog_direction)#
Jog the waveplate in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- abstractmethod move_absolute(position)#
Move the waveplate to a certain angle.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- abstractmethod set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (None | HomeDirection) – The home direction.
limit_switch (None | LimitSwitch) – The limit switch.
home_velocity (None | Quantity) – The home velocity.
offset_distance (None | Quantity) – The offset distance.
- Return type:
None
- abstractmethod set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (None | JogMode) – The jog mode.
jog_step_size (None | Quantity) – The jog step size.
jog_minimum_velocity (None | Quantity) – The minimum velocity.
jog_acceleration (None | Quantity) – The acceleration.
jog_maximum_velocity (None | Quantity) – The maximum velocity.
jog_stop_mode (None | StopMode) – The stop mode.
- Return type:
None
- abstractmethod set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- class pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateHomeParams(*args, **kwargs)#
Bases:
UserDict
[str
,Any
]- Parameters:
args (Any)
kwargs (Any)
- class pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateJogParams(*args, **kwargs)#
Bases:
UserDict
[str
,Any
]- Parameters:
args (Any)
kwargs (Any)
- class pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateThorlabsK10CR1(*, connection: pnpq.apt.connection.AbstractAptConnection, home_on_init: bool = True)#
Bases:
AbstractWaveplateThorlabsK10CR1
- Parameters:
connection (AbstractAptConnection)
home_on_init (bool)
- connection: AbstractAptConnection#
- get_homeparams()#
Request home parameters from the device.
- Return type:
- get_jogparams()#
Request jog parameters from the device.
- Return type:
- get_velparams()#
Request velocity parameters from the device.
- Return type:
- home()#
Move the waveplate to its home position.
- Return type:
None
- home_on_init: bool = True#
- identify()#
Identify the device by blinking its LED.
- Return type:
None
- is_homed()#
Check if the device is homed. Sends the REQ_STATUSUPDATE message and checks the HOMED status bit.
Returns True if the device is homed, False otherwise.
- Return type:
bool
- jog(jog_direction)#
Jog the waveplate in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(position)#
Move the waveplate to a certain angle.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- set_channel_enabled(enabled)#
- Parameters:
enabled (bool)
- Return type:
None
- set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (HomeDirection | None) – The home direction.
limit_switch (LimitSwitch | None) – The limit switch.
home_velocity (Quantity | None) – The home velocity.
offset_distance (Quantity | None) – The offset distance.
- Return type:
None
- set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (JogMode | None) – The jog mode.
jog_step_size (Quantity | None) – The jog step size.
jog_minimum_velocity (Quantity | None) – The minimum velocity.
jog_acceleration (Quantity | None) – The acceleration.
jog_maximum_velocity (Quantity | None) – The maximum velocity.
jog_stop_mode (StopMode | None) – The stop mode.
- Return type:
None
- set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- class pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateVelocityParams(*args, **kwargs)#
Bases:
UserDict
[str
,Quantity
]- Parameters:
args (Any)
kwargs (Any)
pnpq.devices.waveplate_thorlabs_k10cr1_stub module#
- class pnpq.devices.waveplate_thorlabs_k10cr1_stub.WaveplateThorlabsK10CR1Stub(*, time_scaling_factor: float = 0.0, current_velocity_params: pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateVelocityParams = <factory>, current_jog_params: pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateJogParams = <factory>, current_home_params: pnpq.devices.waveplate_thorlabs_k10cr1.WaveplateHomeParams = <factory>)#
Bases:
AbstractWaveplateThorlabsK10CR1
- Parameters:
time_scaling_factor (float)
current_velocity_params (WaveplateVelocityParams)
current_jog_params (WaveplateJogParams)
current_home_params (WaveplateHomeParams)
- current_home_params: WaveplateHomeParams#
- current_jog_params: WaveplateJogParams#
- current_velocity_params: WaveplateVelocityParams#
- get_homeparams()#
Request home parameters from the device.
- Return type:
- get_jogparams()#
Request jog parameters from the device.
- Return type:
- get_velparams()#
Request velocity parameters from the device.
- Return type:
- home()#
Move the waveplate to its home position.
- Return type:
None
- homed: bool = False#
- identify()#
Identify the device by blinking its LED.
- Return type:
None
- is_homed()#
Check if the device is homed. Sends the REQ_STATUSUPDATE message and checks the HOMED status bit.
Returns True if the device is homed, False otherwise.
- Return type:
bool
- jog(jog_direction)#
Jog the waveplate in a certain direction.
- Parameters:
jog_direction (JogDirection) – The direction to jog in.
- Return type:
None
- log = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>#
- move_absolute(position)#
Move the waveplate to a certain angle.
- Parameters:
position (Quantity) – The angle to move to.
- Return type:
None
- set_homeparams(home_direction=None, limit_switch=None, home_velocity=None, offset_distance=None)#
Set home parameters on the device.
- Parameters:
home_direction (None | HomeDirection) – The home direction.
limit_switch (None | LimitSwitch) – The limit switch.
home_velocity (None | Quantity) – The home velocity.
offset_distance (None | Quantity) – The offset distance.
- Return type:
None
- set_jogparams(jog_mode=None, jog_step_size=None, jog_minimum_velocity=None, jog_acceleration=None, jog_maximum_velocity=None, jog_stop_mode=None)#
Set jog parameters on the device.
- Parameters:
jog_mode (None | JogMode) – The jog mode.
jog_step_size (None | Quantity) – The jog step size.
jog_minimum_velocity (None | Quantity) – The minimum velocity.
jog_acceleration (None | Quantity) – The acceleration.
jog_maximum_velocity (None | Quantity) – The maximum velocity.
jog_stop_mode (None | StopMode) – The stop mode.
- Return type:
None
- set_velparams(minimum_velocity=None, acceleration=None, maximum_velocity=None)#
Set velocity parameters on the device.
- Parameters:
minimum_velocity (None | Quantity) – The minimum velocity. According to the documentation, this should always be 0. Therefore this parameter can be left unused.
acceleration (None | Quantity) – The acceleration.
maximum_velocity (None | Quantity) – The maximum velocity.
- Return type:
None
- time_scaling_factor: float = 0.0#