navigate.controller.sub_controllers.waveform_popup.WaveformPopupController
- class navigate.controller.sub_controllers.waveform_popup.WaveformPopupController(view: PopUp, parent_controller, waveform_constants_path: str)
Bases:
GUIController
Controller for the waveform popup window.
This controller is responsible for the waveform popup window. It is responsible for updating the waveform constants in the configuration file and saving the waveform constants to a file.
- __init__(view: PopUp, parent_controller, waveform_constants_path: str) → None
Initialize the WaveformPopupController.
- Parameters:
view (WaveformPopup) – The view for the controller.
parent_controller (Controller) – The parent controller.
waveform_constants_path (str) – The path to the waveform constants file.
Methods
__init__
(view, parent_controller, ...)Initialize the WaveformPopupController.
close_window
(*args)Close the window.
Update widget ranges and precisions based on the current resolution mode.
Display advanced galvo setting window
display_galvo_advanced_setting
(*args, **kwargs)Generate dynamic galvo advanced setting widgets
estimate_galvo_setting
(*args, **kwargs)Digitally scanned light-sheet frequency estimation.
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
([force_update])Set experiment values.
register_event_listener
(event_name, ...)Register event listener in the parent_controller
Restore amplitude values to previous values.
Save updated waveform parameters to yaml file.
Sets values of widgets based on experiment setting
set_galvo_factor
([galvo_factor])Set galvo factor and display information
Set galvo factor to 'none' and use galvo parameters in all channels
show_laser_info
(*args)Show laser info when the user changes magnification setting.
show_magnification
(*args)Show magnification options when the user changes the focus mode.
show_verbose_info
(*info)Prints verbose information to the console
showup
()This function will let the popup window show in front.
Temporarily disable waveform amplitude for quick alignment on stationary beam.
Collects all the values of widgets
update_galvo_advanced_setting
(factor_id, ...)Update galvo setting parameters
update_galvo_setting
(galvo_name, ...)Update galvo settings in memory.
update_remote_focus_settings
(name, laser, ...)Update remote focus settings in memory.
update_waveform_parameters
(*args, **kwargs)Update the waveform parameters for delay, duty cycle, and smoothing.
Attributes
Custom events for the controller
Waveform constants for the microscope.
Galvo constants for the microscope.
The configuration controller.
The path to the waveform constants file.
The widgets for the mode and magnification.
The variables for the mode and magnification.
The lasers.
The current resolution.
The current magnification.
The current microscope operation mode.
Remote focus experiment dictionary.
Flag to update galvo device.
Flag to update waveform parameters.
Flag to enable/disable waveforms.
Dictionary of amplitude values.
the minimum value of remote focus device
the maximum value of remote focus device
Dictionary of galvo minimum values
Dictionary of galvo maximum values
The event id.
- close_window(*args) → None
Close the window.
- configure_widget_range() → None
Update widget ranges and precisions based on the current resolution mode.
TODO: Other parameters we wish to enable/disable based on configuration?
TODO: Should we instead change galvo amp/offset behavior based on a waveform type passed in the configuration? That is, should we pass galvo_l_waveform: sawtooth and galvo_r_waveform: dc_value? And then adjust the ETL_Popup_Controller accordingly? We could do the same for ETL vs. voice coil.
This function updates the widget ranges and precisions based on the current resolution mode. The precision is set to -3 for high and nanoscale modes and -2 for low mode. The increment is set to 0.001 for high and nanoscale modes and 0.01 for low mode.
- display_advanced_setting_window() → None
Display advanced galvo setting window
- display_galvo_advanced_setting(*args: tuple, **kwargs: dict) → None
Generate dynamic galvo advanced setting widgets
- estimate_galvo_setting(*args: tuple, **kwargs: dict) → None
Digitally scanned light-sheet frequency estimation.
When imaging in a digitally scanned light-sheet mode, the galvo must operate at a specific frequency, otherwise periodic lines will appear in the image. This function estimates the frequency of the galvo based on the line interval and the number of pixels in the light-sheet mode.
Note
Will only work if all channels have the same exposure duration. The framerate widget doesn’t update unless you change the exposure time in the channel settings. Default is 100ms.
- Parameters:
*args (tuple) – The first element is the name of the galvo.
**kwargs (dict) – The key is the name of the galvo and the value is the galvo setting.
- 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(force_update: bool = False) → None
Set experiment values.
- Parameters:
force_update (bool, optional) – If true, the experiment values will be updated, by default False
- 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
- restore_amplitude() → None
Restore amplitude values to previous values.
- save_waveform_constants() → None
Save updated waveform parameters to yaml file.
- set_experiment_values()
Sets values of widgets based on experiment setting
setting_dict is a dictionary
- set_galvo_factor(galvo_factor: str = 'none') → None
Set galvo factor and display information
- Parameters:
galvo_factor (str) – The name of galvo factor: ‘laser’, ‘channel’, or ‘none’
- set_galvo_to_all_channels() → None
Set galvo factor to ‘none’ and use galvo parameters in all channels
- show_laser_info(*args: tuple) → None
Show laser info when the user changes magnification setting.
- Parameters:
*args (tuple) – The first element is the new magnification setting.
- show_magnification(*args: tuple) → None
Show magnification options when the user changes the focus mode.
- Parameters:
*args (tuple) – The first element is the new focus mode.
- show_verbose_info(*info)
Prints verbose information to the console
- Parameters:
info (tuple) – information to be printed
- showup() → None
This function will let the popup window show in front.
- toggle_waveform_state()
Temporarily disable waveform amplitude for quick alignment on stationary beam.
- update_experiment_values()
Collects all the values of widgets
setting_dict is a reference of experiment dictionary update the dictionary directly
- update_galvo_advanced_setting(factor_id: int, galvo_id: int, factor_name: str, amp_or_off: str) → None
Update galvo setting parameters
- Parameters:
factor_id (int) – The index of the galvo factor
galvo_id (int) – The index of the galvo device
factor_name (str) – The name of galvo associated factor
amp_or_off (str) – Amplitude or Offset: the value should be “amp” or “off
- Returns:
func – A widget function
- Return type:
Function
- update_galvo_setting(galvo_name: str, widget_name: str, parameter: str) → None
Update galvo settings in memory.
- Parameters:
galvo_name (str) – The name of the galvo.
widget_name (str) – The name of the widget.
parameter (str) – The name of the parameter.
- Returns:
func_galvo – The function to update the galvo setting.
- Return type:
function
- update_remote_focus_settings(name: str, laser: str, remote_focus_name: str) → None
Update remote focus settings in memory.
- Parameters:
name (str) – The name of the variable.
laser (str) – The name of the laser.
remote_focus_name (str) – The name of the remote focus setting.
- update_waveform_parameters(*args: tuple, **kwargs: dict) → None
Update the waveform parameters for delay, duty cycle, and smoothing.
Communicate changes to the parent controller.
- Parameters:
*args (tuple) – The first element is the new waveform.
**kwargs (dict) – The key is the name of the waveform and the value is the waveform
- amplitude_dict
Dictionary of amplitude values.
- Type:
dict
- configuration_controller
The configuration controller.
- Type:
- property custom_events
Custom events for the controller
- event_id
The event id.
- Type:
int
- galvo_max
Dictionary of galvo maximum values
- Type:
dict
- galvo_min
Dictionary of galvo minimum values
- Type:
dict
- galvo_setting
Galvo constants for the microscope.
- Type:
dict
- laser_max
the maximum value of remote focus device
- Type:
float
- laser_min
the minimum value of remote focus device
- Type:
float
- lasers
The lasers.
- Type:
list
- mag
The current magnification.
- Type:
str
- mode
The current microscope operation mode.
- Type:
str
- parent_controller
parent controller
- Type:
- remote_focus_experiment_dict
Remote focus experiment dictionary.
- Type:
dict
- resolution
The current resolution.
- Type:
str
- resolution_info
Waveform constants for the microscope.
- Type:
dict
- update_galvo_device_flag
Flag to update galvo device.
- Type:
bool
- update_waveform_parameters_flag
Flag to update waveform parameters.
- Type:
bool
- variables
The variables for the mode and magnification.
- Type:
dict
- view
GUI view
- Type:
tkinter.Tk
- waveform_constants_path
The path to the waveform constants file.
- Type:
str
- waveforms_enabled
Flag to enable/disable waveforms.
- Type:
bool
- widgets
The widgets for the mode and magnification.
- Type:
dict