msl.equipment.resources.thorlabs.kinesis.filter_flipper module
This module provides all the functionality required to control a Filter Flipper (MFF101, MFF102).
- class msl.equipment.resources.thorlabs.kinesis.filter_flipper.FilterFlipper(record)[source]
Bases:
MotionControl
A wrapper around
Thorlabs.MotionControl.FilterFlipper.dll
.The
properties
for a FilterFlipper connection supports the following key-value pairs in the Connections Database:'device_name': str, the device name found in ThorlabsDefaultSettings.xml [default: None]
Do not instantiate this class directly. Use the
connect()
method to connect to the equipment.- Parameters:
record (
EquipmentRecord
) – A record from an Equipment-Register Database.
- MIN_TRANSIT_TIME = 300
- MAX_TRANSIT_TIME = 2800
- MIN_PULSE_WIDTH = 10
- MAX_PULSE_WIDTH = 200
- open()[source]
Open the device for communication.
- Raises:
ThorlabsError – If not successful.
- check_connection()[source]
Check connection.
- Returns:
bool
– Whether the USB is listed by the FTDI controller.
- get_hardware_info()[source]
Gets the hardware information from the device.
- Returns:
structs.TLI_HardwareInformation
– The hardware information.- Raises:
ThorlabsError – If not successful.
- get_firmware_version()[source]
Gets version number of the device firmware.
- Returns:
str
– The firmware version.
- get_software_version()[source]
Gets version number of the device software.
- Returns:
str
– The device software version.
- load_settings()[source]
Update device with stored settings.
The settings are read from
ThorlabsDefaultSettings.xml
, which gets created when the Kinesis software is installed.- Raises:
ThorlabsError – If not successful.
- load_named_settings(settings_name)[source]
Update device with named settings.
- Parameters:
settings_name (
str
) – The name of the device to load the settings for. Examples for the value of setting_name can be found in ThorlabsDefaultSettings.xml`, which gets created when the Kinesis software is installed.- Raises:
ThorlabsError – If not successful.
- persist_settings()[source]
Persist the devices current settings.
- Raises:
ThorlabsError – If not successful.
- get_number_positions()[source]
Get number of positions available from the device.
- Returns:
int
– The number of positions.
- home()[source]
Home the device.
Homing the device will set the device to a known state and determine the home position.
- Raises:
ThorlabsError – If not successful.
- move_to_position(position)[source]
Move the device to the specified position (index).
- Parameters:
position (
int
) – The required position. Must be 1 or 2.- Raises:
ThorlabsError – If not successful.
- get_position()[source]
Get the current position.
- Returns:
int
– The position, 1 or 2 (can be 0 during a move).
- get_io_settings()[source]
Gets the I/O settings from filter flipper.
- Returns:
FF_IOSettings
– The Filter Flipper I/O settings.- Raises:
ThorlabsError – If not successful.
- request_io_settings()[source]
Requests the I/O settings from the filter flipper.
- Raises:
ThorlabsError – If not successful.
- set_io_settings(transit_time=500, oper1=FF_IOModes.FF_ToggleOnPositiveEdge, sig1=FF_SignalModes.FF_InputButton, pw1=200, oper2=FF_IOModes.FF_ToggleOnPositiveEdge, sig2=FF_SignalModes.FF_OutputLevel, pw2=200)[source]
Sets the settings on filter flipper.
- Parameters:
transit_time (
int
, optional) – Time taken to get from one position to other in milliseconds.oper1 (
FF_IOModes
, optional) – I/O 1 Operating Mode.sig1 (
FF_SignalModes
, optional) – I/O 1 Signal Mode.pw1 (
int
, optional) – Digital I/O 1 pulse width in milliseconds.oper2 (
FF_IOModes
, optional) – I/O 2 Operating Mode.sig2 (
FF_SignalModes
, optional) – I/O 2 Signal Mode.pw2 (
int
, optional) – Digital I/O 2 pulse width in milliseconds.
- Raises:
ThorlabsError – If not successful.
- set_transit_time(transit_time)[source]
Sets the transit time.
- Parameters:
transit_time (
int
) – The transit time in milliseconds.- Raises:
ThorlabsError – If not successful.
- request_status()[source]
Request status bits.
This needs to be called to get the device to send it’s current status.
This is called automatically if Polling is enabled for the device using
start_polling()
.- Raises:
ThorlabsError – If not successful.
- get_status_bits()[source]
Get the current status bits.
This returns the latest status bits received from the device. To get new status bits, use
request_status()
or use the polling function,start_polling()
- Returns:
int
– The status bits from the device.
- start_polling(milliseconds)[source]
Starts the internal polling loop.
This function continuously requests position and status messages.
- Parameters:
milliseconds (
int
) – The polling rate, in milliseconds.- Raises:
ThorlabsError – If not successful.
- polling_duration()[source]
Gets the polling loop duration.
- Returns:
int
– The time between polls in milliseconds or 0 if polling is not active.
- time_since_last_msg_received()[source]
Gets the time, in milliseconds, since tha last message was received.
This can be used to determine whether communications with the device is still good.
- Returns:
int
– The time, in milliseconds, since the last message was received.
- enable_last_msg_timer(enable, msg_timeout=0)[source]
Enables the last message monitoring timer.
This can be used to determine whether communications with the device is still good.
- has_last_msg_timer_overrun()[source]
Queries if the time since the last message has exceeded the
lastMsgTimeout
set byenable_last_msg_timer()
.This can be used to determine whether communications with the device is still good.
- request_settings()[source]
Requests that all settings are downloaded from the device.
This function requests that the device upload all it’s settings to the DLL.
- Raises:
ThorlabsError – If not successful.
- register_message_callback(callback)[source]
Registers a callback on the message queue.
- Parameters:
callback (
MotionControlCallback
) – A function to be called whenever messages are received.
- message_queue_size()[source]
Gets the size of the message queue.
- Returns:
int
– The number of messages in the queue.
- get_next_message()[source]
Get the next Message Queue item. See
messages
.- Returns:
- Raises:
ThorlabsError – If not successful.