@@ -533,11 +533,18 @@ def update_waveform_parameters(self, *args, **wargs):
533533 )
534534
535535 def estimate_galvo_setting (self , * args , ** kwargs ):
536- """Estimate galvo settings according to the acquisition parameters .
536+ """Digitally scanned light-sheet frequency estimation .
537537
538- Will only work if all channels have the same exposure duration.
539- Gets the line interval from the camera, number of pixels from the light-sheet
540- mode, and estimates the frequency as 1 / (line interval * number of pixels).
538+ When imaging in a digitally scanned light-sheet mode, the galvo must
539+ operate at a specific frequency, otherwise periodic lines will appear in
540+ the image. This function estimates the frequency of the galvo based on the
541+ line interval and the number of pixels in the light-sheet mode.
542+
543+ Note
544+ ----
545+ Will only work if all channels have the same exposure duration.
546+ The framerate widget doesn't update unless you change the
547+ exposure time in the channel settings. Default is 100ms.
541548
542549 Parameters
543550 ----------
@@ -547,37 +554,36 @@ def estimate_galvo_setting(self, *args, **kwargs):
547554 The key is the name of the galvo and the value is the galvo setting.
548555 """
549556
557+ # Get the name of the galvo.
550558 galvo_name = args [0 ]
551559
560+ # Get the number of pixels in the light-sheet mode.
552561 number_of_pixels = (
553562 self .parent_controller .camera_setting_controller .mode_widgets [
554563 "Pixels"
555564 ].get ()
556565 )
566+
567+ # If not in the light-sheet mode, widget returns an empty string.
557568 if number_of_pixels == "" :
558- # If we are not in the light-sheet mode, widget returns an empty string.
559569 return
560570
561- # TODO: Worth noting that this doesn't matter because it cancels out in the
562- # frequency bit, but this is often not the right value. The framerate widget
563- # doesn't update unless you change the exposure time in the channel settings.
564- # It launches as a default of 100 ms every time.
571+ # Get the exposure time. Convert to seconds.
565572 exposure_time = (
566573 self .parent_controller .camera_setting_controller .framerate_widgets [
567574 "exposure_time"
568575 ].get ()
569576 )
577+ exposure_time = exposure_time / 1000
570578
571- # The camera line interval won't be set until starting acquisition,
572- # we need to calculate it directly
573- # exposure_time and light_sheet_exposure_time are both ms
579+ # Get the light sheet exposure time.
574580 (
575- light_sheet_exposure_time ,
576- _ ,
581+ light_sheet_exposure_time , _ , _ ,
577582 ) = self .parent_controller .model .get_camera_line_interval_and_exposure_time (
578583 exposure_time , int (number_of_pixels ) + 1
579- ) # TODO: Unclear why we need the +1. Figure out the reason.
584+ )
580585
586+ # Calculate the frequency of the galvo.
581587 frequency = 2 / light_sheet_exposure_time * exposure_time
582588
583589 # Update the GUI
0 commit comments