|
61 | 61 | AcquireBarController,
|
62 | 62 | FeaturePopupController,
|
63 | 63 | MenuController,
|
| 64 | + # MicroscopePopupController, |
| 65 | + # AdaptiveOpticsPopupController, |
64 | 66 | )
|
65 | 67 |
|
66 | 68 | from aslm.controller.thread_pool import SynchronizedThreadPool
|
@@ -298,30 +300,35 @@ def update_acquire_control(self):
|
298 | 300 | command=self.stage_controller.stop_button_handler
|
299 | 301 | )
|
300 | 302 |
|
301 |
| - def change_microscope(self, microscope_name): |
| 303 | + def change_microscope(self, microscope_name, zoom=None): |
302 | 304 | """Change the microscope configuration.
|
303 | 305 |
|
304 | 306 | Parameters
|
305 | 307 | ----------
|
306 | 308 | microscope_name : string
|
307 | 309 | Name of the microscope to change to.
|
| 310 | + zoom : string |
| 311 | + Name of the zoom value to change to. |
308 | 312 | """
|
309 | 313 | self.configuration["experiment"]["MicroscopeState"][
|
310 | 314 | "microscope_name"
|
311 | 315 | ] = microscope_name
|
| 316 | + if zoom: |
| 317 | + self.configuration["experiment"]["MicroscopeState"]["zoom"] = zoom |
312 | 318 | if self.configuration_controller.change_microscope():
|
313 | 319 | # update widgets
|
314 | 320 | self.stage_controller.initialize()
|
315 | 321 | self.channels_tab_controller.initialize()
|
316 | 322 | self.camera_setting_controller.update_camera_device_related_setting()
|
317 | 323 | self.camera_setting_controller.calculate_physical_dimensions()
|
318 |
| - if ( |
319 |
| - hasattr(self, "waveform_popup_controller") |
320 |
| - and self.waveform_popup_controller |
321 |
| - ): |
322 |
| - self.waveform_popup_controller.populate_experiment_values() |
323 | 324 | self.camera_view_controller.update_snr()
|
324 | 325 |
|
| 326 | + if ( |
| 327 | + hasattr(self, "waveform_popup_controller") |
| 328 | + and self.waveform_popup_controller |
| 329 | + ): |
| 330 | + self.waveform_popup_controller.populate_experiment_values() |
| 331 | + |
325 | 332 | def initialize_cam_view(self):
|
326 | 333 | """Populate view tab.
|
327 | 334 |
|
@@ -590,22 +597,28 @@ def execute(self, command, *args):
|
590 | 597 |
|
591 | 598 | Parameters
|
592 | 599 | ----------
|
593 |
| - args : dict |
594 |
| - dict = {'resolution_mode': self.resolution, |
595 |
| - 'zoom': self.mag, |
596 |
| - 'laser_info': self.resolution_info[ |
597 |
| - 'remote_focus_constants'][self.resolution][self.mag] |
598 |
| - } |
| 600 | + args : str |
| 601 | + "microscope_name zoom_value", "microscope_name", or "zoom_value" |
599 | 602 | """
|
600 |
| - microscope_name, zoom = self.menu_controller.resolution_value.get().split() |
601 |
| - self.configuration["experiment"]["MicroscopeState"]["zoom"] = zoom |
602 |
| - if ( |
603 |
| - microscope_name |
604 |
| - != self.configuration["experiment"]["MicroscopeState"][ |
605 |
| - "microscope_name" |
606 |
| - ] |
607 |
| - ): |
608 |
| - self.change_microscope(microscope_name) |
| 603 | + # get microscope name and zoom value from args[0] |
| 604 | + temp = args[0].split() |
| 605 | + if len(temp) == 1: |
| 606 | + # microscope name is given |
| 607 | + if temp[0] in self.configuration_controller.microscope_list: |
| 608 | + temp.append( |
| 609 | + self.configuration_controller.get_zoom_value_list(temp[0])[0] |
| 610 | + ) |
| 611 | + elif temp[0] in self.configuration_controller.get_zoom_value_list( |
| 612 | + self.configuration_controller.microscope_name |
| 613 | + ): |
| 614 | + temp = [self.configuration_controller.microscope_name, temp[0]] |
| 615 | + else: |
| 616 | + return |
| 617 | + resolution_value = " ".join(temp) |
| 618 | + if resolution_value != self.menu_controller.resolution_value.get(): |
| 619 | + self.menu_controller.resolution_value.set(resolution_value) |
| 620 | + return |
| 621 | + self.change_microscope(temp[0], temp[1]) |
609 | 622 | work_thread = self.threads_pool.createThread(
|
610 | 623 | "model", lambda: self.model.run_command("update_setting", "resolution")
|
611 | 624 | )
|
@@ -647,6 +660,30 @@ def execute(self, command, *args):
|
647 | 660 | "model", lambda: self.model.run_command("stage_limits", *args)
|
648 | 661 | )
|
649 | 662 |
|
| 663 | + # mirror commands: |
| 664 | + elif command == "flatten_mirror": |
| 665 | + self.model.run_command("flatten_mirror", *args) |
| 666 | + elif command == "zero_mirror": |
| 667 | + self.model.run_command("zero_mirror", *args) |
| 668 | + elif command == "set_mirror": |
| 669 | + self.model.run_command("set_mirror", *args) |
| 670 | + elif command == "set_mirror_from_wcs": |
| 671 | + self.model.run_command("set_mirror_from_wcs", *args) |
| 672 | + elif command == "save_wcs_file": |
| 673 | + self.model.run_command("save_wcs_file", *args) |
| 674 | + elif command == "tony_wilson": |
| 675 | + self.threads_pool.createThread( |
| 676 | + "camera", |
| 677 | + self.capture_image, |
| 678 | + args=( |
| 679 | + "tony_wilson", |
| 680 | + "live", |
| 681 | + ), |
| 682 | + ) |
| 683 | + |
| 684 | + # elif command == "change_camera": |
| 685 | + # self.model.run_command("change_camera", *args) |
| 686 | + |
650 | 687 | elif command == "autofocus":
|
651 | 688 | """Execute autofocus routine."""
|
652 | 689 | self.threads_pool.createThread(
|
@@ -1091,6 +1128,18 @@ def update_event(self):
|
1091 | 1128 | data=value[0], line_plot=value[1], clear_data=value[2]
|
1092 | 1129 | )
|
1093 | 1130 |
|
| 1131 | + elif event == "tonywilson": |
| 1132 | + if hasattr(self, "ao_popup_controller"): |
| 1133 | + # self.ao_popup_controller.set_widgets_from_coef(value['coefs']) |
| 1134 | + self.ao_popup_controller.plot_tonywilson(value) |
| 1135 | + # self.ao_popup_controller.plot_mirror(value) |
| 1136 | + if value["done"]: |
| 1137 | + print("Tony Wilson done! Updating expt...") |
| 1138 | + self.ao_popup_controller.update_experiment_values() |
| 1139 | + elif event == "mirror_update": |
| 1140 | + if hasattr(self, "ao_popup_controller"): |
| 1141 | + self.ao_popup_controller.set_widgets_from_coef(value["coefs"]) |
| 1142 | + self.ao_popup_controller.plot_mirror(value) |
1094 | 1143 | elif event == "stop":
|
1095 | 1144 | # Stop the software
|
1096 | 1145 | break
|
|
0 commit comments