class documentation

class SmartStackParams(StackParams): (source)

View In Hierarchy

A class for holding smart stack parameters, and returning computed ones.

Class Method check_images_to_save Verify that the images to save parameter is positive and odd.
Class Method check_images_to_test Verify that the images to test parameter matches various constraints.
Method check_image_limits Ensure the number of images to save isn't more than the minimum tested.
Method slice_to_save Return the slice of images to save given the index of the sharpest image.
Class Variable check_turning_points Whether to check the number of turning points in the sharpnesses of the images in the stack is exactly 1. (May fail with thick samples)
Class Variable img_undershoot How far below (in factors of stack_dz) the estimated optimal starting position to begin the stack. Better to start slightly too low and require many images, rather than too high and needing to autofocus and restart the stack...
Class Variable max_attempts Maximum number of times to attempt fast stack
Class Variable min_images_to_test Undocumented
Class Variable save_on_failure Whether to save an image even if no focus was found.
Class Variable stack_height_limit How many images can be appended to the stack after the predicted peak to test for focus before assuming the focus was passed, and restarting the stack
Property max_images_to_test The maximum number of images that will be captured and tested in a stack.
Property stack_z_range The range of the z stack, in steps.
Property steps_undershoot The distance to deliberately undershoot the estimated optimal starting point.

Inherited from StackParams:

Class Variable images_to_save Undocumented
Class Variable settling_time Time (in seconds) between moving and capturing an image
Class Variable stack_dz Undocumented
@field_validator('images_to_save')
@classmethod
def check_images_to_save(cls, images_to_save: int) -> int: (source)

Verify that the images to save parameter is positive and odd.

@field_validator('min_images_to_test')
@classmethod
def check_images_to_test(cls, min_images_to_test: int) -> int: (source)

Verify that the images to test parameter matches various constraints.

@model_validator(mode='after')
def check_image_limits(self) -> SmartStackParams: (source)

Ensure the number of images to save isn't more than the minimum tested.

def slice_to_save(self, sharpest_index: int) -> slice: (source)

Return the slice of images to save given the index of the sharpest image.

check_turning_points: bool = (source)

Whether to check the number of turning points in the sharpnesses of the images in the stack is exactly 1. (May fail with thick samples)

img_undershoot: int = (source)

How far below (in factors of stack_dz) the estimated optimal starting position to begin the stack. Better to start slightly too low and require many images, rather than too high and needing to autofocus and restart the stack

max_attempts: int = (source)

Maximum number of times to attempt fast stack

min_images_to_test: int = (source)

Undocumented

save_on_failure: bool = (source)

Whether to save an image even if no focus was found.

stack_height_limit: int = (source)

How many images can be appended to the stack after the predicted peak to test for focus before assuming the focus was passed, and restarting the stack

@computed_field
@property
max_images_to_test: int = (source)

The maximum number of images that will be captured and tested in a stack.

This is 15 images more then the minimum number that are captured.

@computed_field
@property
stack_z_range: int = (source)

The range of the z stack, in steps.

Note that this is the range of the minimum number of images captured, which is also the range of the images stored in memory that can be saved.

@computed_field
@property
steps_undershoot: int = (source)

The distance to deliberately undershoot the estimated optimal starting point.