PYME.Acquire.stage_leveling module

class PYME.Acquire.stage_leveling.StageLeveler(scope, offset_piezo, pause_on_relocate=0.25, focus_lock=None)

Bases: object

Allows semi-automated mapping of coverslip positions are various lateral positions using a focus lock/offset piezo to determine the offset.

Parameters
scope: PYME.Acquire.microscope.microscope
offset_piezo: PYME.Acquire.Hardware.offsetPiezoREST.OffsetPiezo
pause_on_relocate: float

[optional] time to pause during measure loop after moving to a new location and before measuring offset.

focus_lockPYME.Acquire.Hardware.focus_locks

Notes

Units are derived from PYME.Acquire.microscope.microscope.GetPos and SetPos and should be in micrometers.

Attributes
_positionslist

list of position dictionaries with ‘x’ and ‘y’ keys in units of micrometers.

_scans: list of dict

list of measurement iterations. Each scan is a dict with ‘x’, ‘y’, and ‘offset’ keys which each return 1d arrays, all in units of micrometers.

acquire_focus_lock()
add_96wp_positions(short='x')

Shortcut for queueing center positions on a 96-well plate from minimum x, y well. x (8 well) should be short axis, y (12 well) long

Parameters
short: str

stage dimension of the short axis (8 wells) of the plate. Defaults to x.

add_grid(x_length, y_length, x_spacing, y_spacing, center)

Add a grid of set spacings to the list of positions to scan when measuring offsets.

Parameters x_length : float

approximate x length to span in the grid, units of micrometers.

y_lengthfloat

approximate y length to span in the grid, units of micrometers.

x_spacingfloat

x grid spacing, micrometers.

y_spacingfloat

y grid spacing, micrometers.’

centerbool

center the grid on the current position (True) or take the current scope position to be the smallest x, y position to queue (False)

add_ibidi8wellslide_positions(short='x')

Shortcut for queueing center positions on a ibidi 8 well slide from minimum x, y well. x (2 well) should be short axis, y (4 well) long

Parameters
short: str

stage dimension of the short axis (2 wells) of the plate. Defaults to x.

add_position()

Add the current microscope position to the list of positions to be scanned on subsequent calls to measure_offsets.

clear_positions()

Removes all positions stored by the stage leveler (positions to visit, not scans of visited positions)

property current_scan
lookup_offset(x, y, default=0)

use a stored scan to estimate what the z offset should be at a given xy position

Parameters
xfloat

x position in micrometers

yfloat

y position in micrometers

Returns
float

offset at xy from interpolated scan

measure_offsets(optimize_path=True, use_previous_scan=True)

Visit each position and log the offset

Parameters
optimize_pathbool

Flag to toggle visiting the positions in an order which minimizes the path relative to the microscope starting position.

plot(index=-1, interpolation_factor=50)
static plot_scan(scan, interpolation_factor=50)
Parameters
scan: dict

x: x positions y: y positions offset: offset positions

interpolation_factor: int

number of points along x and y to interpolate the offset map.

store_scan(index=-1)