navigate.model.devices.APIs.asi.asi_MFC_controller.MFCTwoThousand
- class navigate.model.devices.APIs.asi.asi_MFC_controller.MFCTwoThousand(com_port: str, baud_rate: int, verbose: bool = False)
Bases:
TigerController
ASI MFC2000 Controller Class
- __init__(com_port: str, baud_rate: int, verbose: bool = False)
Initialize the Tiger Controller class
- Parameters:
com_port (str) – COM port of the Tiger Controller
baud_rate (int) – Baud rate of the Tiger Controller
verbose (bool) – If True, will print out messages to the console
Methods
__init__
(com_port, baud_rate[, verbose])Initialize the Tiger Controller class
change_filter_wheel_speed
([speed])Change the Filter Wheel Speed
connect_to_serial
([rx_size, tx_size, ...])Connect to the serial port.
Disconnect from the serial port if it's open.
get_axis_position
(axis)Return the position of the stage in ASI units (tenths of microns).
get_axis_position_um
(axis)Return the position of the stage in microns.
Get the default motor axis sequence from the ASI device
Get encoder counts pre mm of axis
get_position
(axes)Return current stage position in ASI units.
get_speed
(axis)Get speed
Halt filter wheel
is_axis_busy
(axis)Returns True if the axis is busy.
Returns True if any axis is busy.
Check to see if the stage is moving.
is_open
()Returns True if the serial port exists and is open.
move
(pos_dict)Move the stage with an absolute move on multiple axes
move_axis
(axis, distance)Move the stage with an absolute move on one axis
move_dichroic
(dichroic_id[, dichroic_position])Move Dichroic Slider.
move_filter_wheel
([filter_wheel_position])Move Filter Wheel
Move the Filter Wheel to Home Position
moverel
([x, y, z])Move the stage with a relative move on multiple axes.
moverel_axis
(axis, distance)Move the stage with a relative move on one axis
Read a line from the serial response.
report_to_console
(message)Print message to the output device, usually the console.
Scans for available COM ports
scanr
(start_position_mm, end_position_mm[, ...])Set scanr operation mode.
scanv
(start_position_mm, end_position_mm, ...)Set scanv operation mode.
select_filter_wheel
([filter_wheel_number])Select the filter wheel, e.g., 0, 1...
send_command
(cmd)Send a serial command to the device.
Send a serial command to the filter wheel.
set_backlash
(axis, val)Enable/disable stage backlash correction.
set_error
(axis, ac)Set the stage drift error
set_feedback_alignment
(axis, aa)Set the stage feedback alignment.
set_finishing_accuracy
(axis, ac)Set the stage finishing accuracy.
set_max_speed
(axis, speed)Set the speed on a specific axis.
set_speed
(speed_dict)Set speed
Set speed as a percentage of the maximum speed
start_scan
(axis[, is_single_axis_scan])Start scan
stop
()Stop all stage movement immediately
Stop scan.
wait_for_device
([timeout])Waits for the all motors to stop moving.
Attributes
- change_filter_wheel_speed(speed=0)
Change the Filter Wheel Speed
Selects a consistent set of preset acceleration and speed parameters. Supported in version 2.4 and later.
0 Default - directly set and saved AU, AD, and VR parameters are used. 1 Slowest and smoothest switching speed. 2 to 8 Intermediate switching speeds. 9 Fastest but least reliable switching speed.
- connect_to_serial(rx_size: int = 12800, tx_size: int = 12800, read_timeout: int = 1, write_timeout: int = 1) → None
Connect to the serial port.
- Parameters:
rx_size (int) – Size of the rx buffer
tx_size (int) – Size of the tx buffer
read_timeout (int) – Read timeout in seconds
write_timeout (int) – Write timeout in seconds
- disconnect_from_serial() → None
Disconnect from the serial port if it’s open.
- get_axis_position(axis: str) → int
Return the position of the stage in ASI units (tenths of microns).
- Parameters:
axis (str) – Stage axis
- Returns:
Position of the stage in ASI units
- Return type:
int
- get_axis_position_um(axis: str) → float
Return the position of the stage in microns.
- Parameters:
axis (str) – Stage axis
- Returns:
Position of the stage in microns
- Return type:
float
- get_default_motor_axis_sequence() → list[str]
Get the default motor axis sequence from the ASI device
Only returns stage types XYMotor, ZMotor, Theta. Avoids problems associated with other tiger controller cards, which could include piezos, filter wheels, logic cards, etc.
- Returns:
Default motor axis sequence
- Return type:
list[str]
- get_encoder_counts_per_mm(axis: str)
Get encoder counts pre mm of axis
- Parameters:
axis (str) – Stage axis
- Returns:
Encoder counts per mm of axis
- Return type:
float
- get_position(axes) → dict
Return current stage position in ASI units.
If default axes sequence has gotten from the ASI device, then it will ask the device all the position in one command, else it will ask each axis position one by one.
WATCH OUT! This will return the positions in the order of the underlying hardware no matter what order the axes are passed in.
See https://asiimaging.com/docs/products/serial_commands#commandwhere_w
- Parameters:
axes (list[str]) – List of axes to query
- Returns:
{axis: position}
- Return type:
dictionary
- get_speed(axis: str)
Get speed
- Parameters:
axis (str) – Stage axis
- halt_filter_wheel()
Halt filter wheel
- is_axis_busy(axis: str) → bool
Returns True if the axis is busy.
- Parameters:
axis (str) – Stage axis
- Returns:
True if the axis is busy
- Return type:
bool
- is_device_busy() → bool
Returns True if any axis is busy.
- Returns:
True if any axis is busy
- Return type:
bool
- is_moving()
Check to see if the stage is moving.
Sends the command / which is equivalent to STATUS
Gets response: N - there are no motors running from a serial command B - there is a motor running from a serial command
- Returns:
response – True if any axis is moving. False if not.
- Return type:
Bool
- is_open() → bool
Returns True if the serial port exists and is open.
- Returns:
True if the serial port exists and is open
- Return type:
bool
- move(pos_dict) → None
Move the stage with an absolute move on multiple axes
- Parameters:
pos_dict (dict) – Dictionary of the form {axis: position}
- move_axis(axis: str, distance: float) → None
Move the stage with an absolute move on one axis
- Parameters:
axis (str) – Stage axis
distance (float) – Absolute move distance
- move_dichroic(dichroic_id, dichroic_position=0)
Move Dichroic Slider.
Move to dichroic position n , where n is a valid filter position. The Motorized C60 Cube Slider from ASI has 4 positions.
- Parameters:
dichroic_id (str) – The ID of the dichroic in the Tiger Controller. e.g., “T”
dichroic_position (int) – The position to move the dichroic to.
- move_filter_wheel(filter_wheel_position=0)
Move Filter Wheel
Move to filter position n , where n is a valid filter position.
- Parameters:
filter_wheel_position (int) – The position to move the filter wheel to.
- move_filter_wheel_to_home()
Move the Filter Wheel to Home Position
Causes current wheel to seek its home position.
- moverel(x: int = 0, y: int = 0, z: int = 0) → None
Move the stage with a relative move on multiple axes.
- Parameters:
x (int) – Relative move on the x-axis
y (int) – Relative move on the y-axis
z (int) – Relative move on the z-axis
- moverel_axis(axis: str, distance: float) → None
Move the stage with a relative move on one axis
- Parameters:
axis (str) – Stage axis
distance (float) – Relative move distance
- read_response() → str
Read a line from the serial response.
- Returns:
Response from the serial port
- Return type:
str
- report_to_console(message: str) → None
Print message to the output device, usually the console.
- Parameters:
message (str) – Message to print to the output device
- static scan_ports() → list[str]
Scans for available COM ports
Returns a sorted list of COM ports.
- Returns:
Sorted list of COM ports
- Return type:
list[str]
- scanr(start_position_mm: float, end_position_mm: float, enc_divide: float = 0, axis: str = 'X')
Set scanr operation mode.
- Parameters:
start_position_mm (float) – Start position in mm
end_position_mm (float) – End position in mm
enc_divide (float) – Encoder divide
axis (str) – Stage axis
- scanv(start_position_mm: float, end_position_mm: float, number_of_lines: float, overshoot: float = 1.0, axis: str = 'X')
Set scanv operation mode.
- Parameters:
start_position_mm (float) – Start position in mm
end_position_mm (float) – End position in mm
number_of_lines (float) – Number of lines
overshoot (float) – Overshoot
axis (str) – Stage axis
- select_filter_wheel(filter_wheel_number=0)
Select the filter wheel, e.g., 0, 1…
Sets the current filter wheel for subsequent commands. Prompt shows currently selected wheel, e.g., 0> is result of FW 0 command. If the selected wheel is HOMED and ready to go, the FW command returns the selected wheel as normal. If the wheel is not ready for any reason, the response ERR is returned. Example:
0> FW 1 1 Normal – switch to FW 1 1> FW 0 ERR FW 0 not ready 0> Although FW 0 not ready – can still change FW 0 parameters.
- Parameters:
filter_wheel_number (int) – The filter wheel number to select.
- send_command(cmd: str) → None
Send a serial command to the device.
- Parameters:
cmd (str) – Serial command to send to the device
- send_filter_wheel_command(cmd) → None
Send a serial command to the filter wheel.
- Parameters:
cmd (str) – Serial command to send to the filter wheel
- set_backlash(axis, val)
Enable/disable stage backlash correction.
This command sets (or displays) the amount of distance in millimeters of the anti-backlash move which absorbs the lash in the axis’ gearing at the end of commanded moves1). This behind-the-scenes move ensures that the controller approaches the final target from the same direction, which improves repeatability when using rotary encoders. A value of zero (0) disables the anti-backlash algorithm for that axis. The default value depends on motor build but is 0.04 for most common 4 TPI leadscrew pitch with rotary encoder, 0.01 for most common 16 TPI leadscrew pitch, and 0.02 for the x-axis of scan-optimized stages. For linear encoders a backlash move is not necessary and there is no reason to change the setting from the default value of zero ( 0). Moves with manual input devices (joystick or knobs) do not have any anti-backlash move.
- Parameters:
axis (str) – Stage axis
val (float) – Distance of anti-backlash motion [mm]
- set_error(axis, ac)
Set the stage drift error
This command sets the Drift Error setting. This setting controls the crossover position error (in millimeters) between the target and position at which the controller considers an axis to be too far out of position when resting. When this limit is reached, the controller will re-attempt to move the axis back within the Finish Error (PC) limit. The current value for this setting can be viewed using the INFO command or by placing a ? after the axis name. Entries of zero value, e.g., ERROR X=0 are ignored.
- Parameters:
axis (str) – Stage axis
ac (float) – Position error [mm]
- set_feedback_alignment(axis, aa)
Set the stage feedback alignment.
Adjusts the drive strength by writing to a non-volatile on-board potentiometer. Normally done once at the factory (to a very conservative value) and never adjusted again. If the AA is off, the stage may be sluggish (too low) or it may oscillate, buzz, or sound like it’s grinding (too high). After changing the AA value the AZERO command should be run until zeroed.
To optimize stage performance a high AA is desirable, but too high and there are big problems. AA can be increased until oscillations occur and then decreased by 1 or 2 as described at the page on tuning stages to minimize move time.
- Parameters:
axis (str) – Stage axis
aa (float) – Hardware potentiometer value
- set_finishing_accuracy(axis, ac)
Set the stage finishing accuracy.
This command sets/displays the Finish Error setting, which controls when the motor algorithm routines will turn off. The setting controls the crossover position error (in millimeters) between the target and position at which the controller will stop attempting to move the stage closer to achieve the ideal position=target. This is value also determines the maximum error allowable before a move is considered complete. This value is by default set to the value of the smallest move step size according to the encoder resolution, but many applications do not require such tight landing tolerance.
- Parameters:
axis (str) – Stage axis
ac (float) – Position error [mm]
- set_max_speed(axis: str, speed: float) → None
Set the speed on a specific axis. Speed is in mm/s.
- Parameters:
axis (str) – Stage axis
speed (float) – Speed in mm/s
- set_speed(speed_dict)
Set speed
- Parameters:
speed_dict (dict) – Dictionary of the form {axis: speed}
- set_speed_as_percent_max(pct)
Set speed as a percentage of the maximum speed
- Parameters:
pct (float) – Percentage of the maximum speed
- start_scan(axis: str, is_single_axis_scan: bool = True)
Start scan
- Parameters:
axis (str) – Stage axis
is_single_axis_scan (bool) – If True, will only scan on one axis
- stop()
Stop all stage movement immediately
- stop_scan()
Stop scan.
- wait_for_device(timeout: float = 1.75) → None
Waits for the all motors to stop moving.
- timeoutfloat
Timeout in seconds. Default is 1.75 seconds.
- baud_rate
Baud rate of the Tiger Controller
- Type:
int
- com_port
COM port of the Tiger Controller
- Type:
str
- default_axes_sequence
Default axes sequence of the Tiger Controller
- Type:
list[str]
- safe_to_write
Event to indicate if it is safe to write to the serial port
- Type:
threading.Event
- serial_port
Serial port object
- Type:
Serial
- verbose
If True, will print out messages to the console
- Type:
bool