Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquanli committed Feb 24, 2025
1 parent 4ba7838 commit 3323ab5
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 224 deletions.
1 change: 1 addition & 0 deletions software/control/_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ class PLATE_READER:
ENABLE_TRACKING = False
TRACKING_SHOW_MICROSCOPE_CONFIGURATIONS = False # set to true when doing multimodal acquisition


class AF:
STOP_THRESHOLD = 0.85
CROP_WIDTH = 800
Expand Down
146 changes: 86 additions & 60 deletions software/control/core/core.py

Large diffs are not rendered by default.

35 changes: 23 additions & 12 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ def loadObjects(self, is_simulation):
self.laserAFSettingManager = core.LaserAFSettingManager()
else:
self.laserAFSettingManager = None
self.configurationManager = core.ConfigurationManager(channel_manager=self.channelConfigurationManager, laser_af_manager=self.laserAFSettingManager)
self.configurationManager = core.ConfigurationManager(
channel_manager=self.channelConfigurationManager, laser_af_manager=self.laserAFSettingManager
)
self.contrastManager = core.ContrastManager()
self.streamHandler = core.StreamHandler()

Expand Down Expand Up @@ -309,7 +311,7 @@ def loadObjects(self, is_simulation):
self.stage,
self.piezo,
self.objectiveStore,
self.laserAFSettingManager
self.laserAFSettingManager,
)

if USE_SQUID_FILTERWHEEL:
Expand Down Expand Up @@ -547,7 +549,9 @@ def waitForMicrocontroller(self, timeout=5.0, error_message=None):
def loadWidgets(self):
# Initialize all GUI widgets
if ENABLE_SPINNING_DISK_CONFOCAL:
self.spinningDiskConfocalWidget = widgets.SpinningDiskConfocalWidget(self.xlight, self.channelConfigurationManager)
self.spinningDiskConfocalWidget = widgets.SpinningDiskConfocalWidget(
self.xlight, self.channelConfigurationManager
)
if ENABLE_NL5:
import control.NL5Widget as NL5Widget

Expand Down Expand Up @@ -684,7 +688,9 @@ def loadWidgets(self):
show_configurations=TRACKING_SHOW_MICROSCOPE_CONFIGURATIONS,
)
if ENABLE_STITCHER:
self.stitcherWidget = widgets.StitcherWidget(self.objectiveStore, self.channelConfigurationManager, self.contrastManager)
self.stitcherWidget = widgets.StitcherWidget(
self.objectiveStore, self.channelConfigurationManager, self.contrastManager
)

self.recordTabWidget = QTabWidget()
self.setupRecordTabWidget()
Expand Down Expand Up @@ -978,19 +984,20 @@ def makeConnections(self):
self.wellSelectionWidget.signal_wellSelected.connect(self.wellplateMultiPointWidget.update_well_coordinates)
self.objectivesWidget.signal_objective_changed.connect(self.wellplateMultiPointWidget.update_coordinates)

self.objectivesWidget.signal_objective_changed.connect(lambda: self.liveControlWidget.update_microscope_mode_by_name(
self.liveControlWidget.currentConfiguration.name
))
self.objectivesWidget.signal_objective_changed.connect(
lambda: self.liveControlWidget.update_microscope_mode_by_name(
self.liveControlWidget.currentConfiguration.name
)
)

if SUPPORT_LASER_AUTOFOCUS:

def connect_objective_changed_laser_af():
self.laserAutofocusController.on_objective_changed()
self.laserAutofocusControlWidget.update_init_state()
self.laserAutofocusSettingWidget.update_values()

self.objectivesWidget.signal_objective_changed.connect(
connect_objective_changed_laser_af
)
self.objectivesWidget.signal_objective_changed.connect(connect_objective_changed_laser_af)
self.laserAutofocusSettingWidget.signal_newExposureTime.connect(
self.cameraSettingWidget_focus_camera.set_exposure_time
)
Expand All @@ -1001,8 +1008,12 @@ def connect_objective_changed_laser_af():
self.laserAutofocusControlWidget.update_init_state
)

self.laserAutofocusSettingWidget.update_exposure_time(self.laserAutofocusSettingWidget.exposure_spinbox.value())
self.laserAutofocusSettingWidget.update_analog_gain(self.laserAutofocusSettingWidget.analog_gain_spinbox.value())
self.laserAutofocusSettingWidget.update_exposure_time(
self.laserAutofocusSettingWidget.exposure_spinbox.value()
)
self.laserAutofocusSettingWidget.update_analog_gain(
self.laserAutofocusSettingWidget.analog_gain_spinbox.value()
)

self.streamHandler_focus_camera.signal_new_frame_received.connect(
self.liveController_focus_camera.on_new_frame
Expand Down
2 changes: 1 addition & 1 deletion software/control/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,4 @@ def get_script_dir(follow_symlinks=True):
return f"{repo.head.object.hexsha} (dirty={repo.is_dirty()})"
except git.GitError as e:
_log.warning(f"Failed to get script git repo info: {e}")
return None
return None
7 changes: 5 additions & 2 deletions software/control/utils_channel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from control._def import CHANNEL_COLORS_MAP


def extract_wavelength_from_config_name(name):
# Split the string and find the wavelength number immediately after "Fluorescence"
parts = name.split()
Expand All @@ -14,5 +15,7 @@ def extract_wavelength_from_config_name(name):


def get_channel_color(channel):
channel_info = CHANNEL_COLORS_MAP.get(extract_wavelength_from_config_name(channel), {"hex": 0xFFFFFF, "name": "gray"})
return channel_info["hex"]
channel_info = CHANNEL_COLORS_MAP.get(
extract_wavelength_from_config_name(channel), {"hex": 0xFFFFFF, "name": "gray"}
)
return channel_info["hex"]
Loading

0 comments on commit 3323ab5

Please sign in to comment.