navigate.controller.sub_controllers.autofocus.AutofocusPopupController
- class navigate.controller.sub_controllers.autofocus.AutofocusPopupController(view: AutofocusPopup, parent_controller: Controller)
Bases:
GUIControllerClass creates the popup to configure autofocus parameters.
- __init__(view: AutofocusPopup, parent_controller: Controller) → None
- Parameters:
view (AutofocusPopup) – The view of the autofocus popup.
parent_controller (navigate.controller.controller.Controller) – The parent controller of the autofocus popup.
Methods
__init__(view, parent_controller)- param view:
The view of the autofocus popup.
close_popup(*_)Close the popup window
display_plot(data_and_flags)Display autofocus data on the coarse axes, handling segmentation, plotting mode, and redraw.
execute(command, *args)This function is called when a command is passed from a child process.
This function is called when the controller is initialized
Populate Experiment Values
register_event_listener(event_name, ...)Register event listener in the parent_controller
Sets values of widgets based on experiment setting
Show Autofocus Parameters
show_verbose_info(*info)Prints verbose information to the console
showup()Shows the popup window
Starts the autofocus process.
Update device reference name
Collects all the values of widgets
update_setting_dict(parameter)Show Autofocus Parameters
Attributes
Custom events for this controller
The autofocus setting dictionary.
The microscope name.
The autofocus setting dictionary.
The autofocus figure.
The autofocus coarse plot.
The autofocus coarse plot.
- close_popup(*_: tuple[str]) → None
Close the popup window
- Parameters:
_ (tuple[str]) – The event arguments.
- display_plot(data_and_flags: tuple[numpy.ndarray, bool, bool]) → None
Display autofocus data on the coarse axes, handling segmentation, plotting mode, and redraw.
This method unpacks and normalizes incoming data, splits it into coarse and fine segments according to the current autofocus settings, renders scatter and/or line plots on the coarse axes, optionally clears previous data, marks the detected maximum(s), and schedules a non-blocking canvas redraw.
- Parameters:
data_and_flags (tuple[np.ndarray, bool, bool]) –
Tuple of (data, line_plot, clear_data). - data : array_like, shape (N, >=2)
Rows are samples; column 0 is x positions (stage), column 1 is signal values. The method converts this to
np.asarray(..., dtype=float)internally.- line_plotbool
If True and data is non-empty, overlay a continuous red line through the points. If False, only scatter markers are drawn.
- clear_databool
If True, the axes are cleared before plotting; when clearing and data exists, the method will call
_plot_maximato draw peak indicators.
- Raises:
ValueError – May be raised if
datais empty or has fewer than two columns (propagated from internal processing or from_plot_maxima).
- execute(command, *args)
This function is called when a command is passed from a child process.
- Parameters:
command (str) – command name
args (tuple) – command arguments
- initialize()
This function is called when the controller is initialized
This function initializes GUI based on configuration setting parameter: configuration_controller set range value for entry or spinbox widgets; add values to combobox get other necessary information for configuration.yml
- populate_experiment_values() → None
Populate Experiment Values
Populates the experiment values from the experiment settings dictionary
- register_event_listener(event_name, event_handler)
Register event listener in the parent_controller
- Parameters:
event_name (str) – event name
event_handler (function) – event handler
- set_experiment_values()
Sets values of widgets based on experiment setting
setting_dict is a dictionary
- show_autofocus_setting(*_: tuple[str]) → None
Show Autofocus Parameters
- Parameters:
_ (tuple[str]) – The event arguments.
- show_verbose_info(*info)
Prints verbose information to the console
- Parameters:
info (tuple) – information to be printed
- showup() → None
Shows the popup window
- start_autofocus() → None
Starts the autofocus process.
- update_device_ref(*_: tuple[str]) → None
Update device reference name
- Parameters:
_ (tuple[str]) – The event arguments.
- update_experiment_values()
Collects all the values of widgets
setting_dict is a reference of experiment dictionary update the dictionary directly
- update_setting_dict(parameter: str) → callable
Show Autofocus Parameters
- Parameters:
parameter (str) – The parameter to be updated.
- Returns:
The function to update the parameter
- Return type:
callable
- autofocus_coarse
The autofocus coarse plot.
- Type:
object
- autofocus_fig
The autofocus figure.
- Type:
object
- coarse_plot
The autofocus coarse plot.
- Type:
object
- property custom_events: dict[str, callable]
Custom events for this controller
- Returns:
The custom events for this controller.
- Return type:
dict[str, callable]
- microscope_name
The microscope name.
- Type:
str
- parent_controller
parent controller
- Type:
- setting_dict
The autofocus setting dictionary.
- Type:
dict
- view
GUI view
- Type:
tkinter.Tk
- widgets
The autofocus setting dictionary.
- Type:
dict