Exemple #1
0
 def __init__(self,
              dev_name='ASI MS2000',
              gui_on=True,
              logger_name='ASI stage'):
     super().__init__()
     self.port = config['port']
     self.baud = config['baud']
     self.timeout_s = config['timeout_s']
     self.units = config['units_mm']
     self.config = config
     self.encoder_step_mm = config['encoder_step_mm']
     self.speed_x = self.speed_y = config['max_speed_mm/s']
     self.pulse_intervals_x = 0.01
     self.enc_counts_per_pulse = round(self.pulse_intervals_x /
                                       self.encoder_step_mm)
     self.scan_limits_xx_yy = [0.0, 0.1, 0.0,
                               0.0]  # [x_start, x_stop, y_start, y_stop]
     self.n_scan_lines = 2
     self._ser = None
     self.initialized = False
     self.position_x_mm = self.position_y_mm = 0.0
     self.target_pos_x_mm = self.target_pos_y_mm = 0.0
     self.backlash_mm = 0.03  # some stages are configured without anti-BL gear for smooth motion, and need a margin.
     # logger setup
     self.logger_name = logger_name
     self.logger = logging.getLogger(logger_name)
     self.logger.setLevel(logging.DEBUG)
     # GUI setup
     self.gui_on = gui_on
     if self.gui_on:
         self.logger.info("GUI activated")
         self.gui = kekse.ProtoKeks(dev_name)
         self._setup_gui()
         self.sig_update_gui.connect(self._update_gui)
Exemple #2
0
 def __init__(self,
              dev_name='Device name',
              gui_on=True,
              logger_name='dev logger'):
     super().__init__()
     self.config = config
     self.initialized = False
     self._status = 'not initialized'
     # logger setup
     self.logger_name = logger_name
     self.logger = logging.getLogger(logger_name)
     self.logger.setLevel(logging.DEBUG)
     # GUI setup
     self.gui_on = gui_on
     if self.gui_on:
         self.logger.info("GUI activated")
         self.gui = kekse.ProtoKeks(dev_name)
         self._setup_gui()
         self.sig_update_gui.connect(self._update_gui)
Exemple #3
0
 def test_decimals(self):
     """
     Numeric field: Computation of decimals from the step.
     """
     print("Numeric field: Computation of decimals from the step:")
     app = QApplication(sys.argv)
     self.gui = kekse.ProtoKeks("Simple Keks")
     self.gui.add_tabs("Control Tabs", tabs=['Tab 1'])
     self.gui.add_label('Representation of Pi: from step to decimals',
                        'Tab 1')
     self.gui.add_numeric_field('Step=1, Decimals=0',
                                'Tab 1',
                                value=np.pi,
                                vrange=[0, 100, 1])
     self.assertEqual(
         self.gui.get_param('Step=1, Decimals=0').decimals(), 0)
     self.gui.add_numeric_field('Step=2, Decimals=0',
                                'Tab 1',
                                value=np.pi,
                                vrange=[0, 100, 2])
     self.assertEqual(
         self.gui.get_param('Step=2, Decimals=0').decimals(), 0)
     self.gui.add_numeric_field('Step=0.1, Decimals=1',
                                'Tab 1',
                                value=np.pi,
                                vrange=[0, 100, 0.1])
     self.assertEqual(
         self.gui.get_param('Step=0.1, Decimals=1').decimals(), 1)
     self.gui.add_numeric_field('Step=0.01, Decimals=2',
                                'Tab 1',
                                value=np.pi,
                                vrange=[0, 100, 0.01])
     self.assertEqual(
         self.gui.get_param('Step=0.01, Decimals=2').decimals(), 2)
     self.gui.add_numeric_field('Step=0.03, Decimals=2',
                                'Tab 1',
                                value=np.pi,
                                vrange=[0, 100, 0.03])
     self.assertEqual(
         self.gui.get_param('Step=0.03, Decimals=2').decimals(), 2)
     self.gui.show()
     app.exec_()
Exemple #4
0
 def __init__(self,
              dev_name='LS generator',
              gui_on=True,
              logger_name='Lightsheet'):
     super().__init__()
     self.config = config
     self.daqmx_task = self.serial_arduino = None
     self.initialized = False
     self.status = "OFF"
     # logger setup
     self.logger_name = logger_name
     self.logger = logging.getLogger(logger_name)
     self.logger.setLevel(logging.DEBUG)
     # GUI setup
     self.gui_on = gui_on
     if self.gui_on:
         self.logger.info("GUI activated")
         self.gui = kekse.ProtoKeks(dev_name)
         self._setup_gui()
         self.sig_update_gui.connect(self._update_gui)
Exemple #5
0
 def __init__(self):
     super().__init__()
     # internal parameters
     self.model_controller = "Thorlabs_MCM3000"
     self.model_stage = 'ZFM2020'
     self.protocol = 'serial'
     self.port = 'COM32'
     self.baud = self.timeout_s = None
     self.max_range_um = self.encoder_offset = self.position_encoder = self.position_um = None
     self.connected = False
     self.__ser_object = None
     self.um_per_count = None
     self.step_size_um = 100
     self.target_um = 0.0
     self.set_stage_model(self.model_stage)
     # GUI
     self.gui = kekse.ProtoKeks(self.model_controller)
     self._setup_gui()
     # signals
     self.sig_update_gui.connect(self._update_gui)
Exemple #6
0
 def __init__(self, gui_on=True, logger_name='ETL'):
     super().__init__()
     self.port = config['port']
     self.baud = config['baud']
     self.timeout_s = config['timeout_s']
     self.logger = logging.getLogger(logger_name)
     self.logger.setLevel(logging.DEBUG)
     self.crc_table = self._init_crc_table()
     self._ser = None
     self._current = self._focalpower = 0
     self._current_max = self._current_upper = 292.84
     self._current_lower = -292.84
     self._status = "Unknown"
     # GUI
     self.gui_on = gui_on
     if self.gui_on:
         self.gui = kekse.ProtoKeks("Optotune ETL")
         self.logger.debug("ETL GUI on")
         self._setup_gui()
         # signals
         self.sig_update_gui.connect(self._update_gui)
Exemple #7
0
 def __init__(self, dev_name='Mirao52e', gui_on=True, logger_name='Mirao'):
     super().__init__()
     self.errors = {}
     self.config = config
     self.initialize_err_codes(self.errors)
     self.dll_path = self.config['dll_path']
     self.flat_file = self.config['flat_file']
     self.cmd_flat = self.dev_handle = None
     self.n_actuators = 52
     self.diameter_mm = 15.0
     self.command = np.zeros(self.n_actuators)
     self._status = ctypes.c_int64(
     )  # possibly c_int32() in some versions, Todo: test
     self._trigger = ctypes.c_int64()
     self.logger = logging.getLogger(logger_name)
     self.logger.setLevel(logging.DEBUG)
     # GUI setup
     self.gui_on = gui_on
     if self.gui_on:
         self.logger.debug("DM GUI on")
         self.gui = kekse.ProtoKeks(dev_name)
         self._setup_gui()
         self.sig_update_gui.connect(self._update_gui)
Exemple #8
0
        dev = devices.hamamatsu_camera.CamController()
    elif dev_title == "thorlabs motion":
        dev = devices.motion_controller_Thorlabs_MCM3000.MotionController()
    elif dev_title == "asi motion":
        dev = devices.stage_ASI_MS2000.MotionController()
    elif dev_title == "lightsheet":
        dev = devices.lightsheet_generator.LightsheetGenerator()
    elif dev_title == "etl":
        dev = devices.etl_controller_Optotune.ETLController()
    elif dev_title == "dm":
        dev = devices.deformable_mirror_Mirao52e.DmController()
    dev.gui.show()


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    gui = kekse.ProtoKeks("GUI demo")
    gui.add_button("Device template", func=partial(load_device, "template"))
    gui.add_button("Camera Hamamatsu", func=partial(load_device, "camera"))
    gui.add_button("Thorlabs motion MCM3000",
                   func=partial(load_device, "thorlabs motion"))
    gui.add_button("ASI motion MS2000",
                   func=partial(load_device, "asi motion"))
    gui.add_button("Lightsheet DAQ generator",
                   func=partial(load_device, "lightsheet"))
    gui.add_button("Optotune ETL", func=partial(load_device, "etl"))
    gui.add_button("Deformable mirror Mirao52e",
                   func=partial(load_device, "dm"))
    gui.show()
    app.exec_()