Ejemplo n.º 1
0
    def __init__(self, *args):
        """
        Description:
        """
        GenericDiffractometer.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.zoom_motor_hwobj = None
        self.camera_hwobj = None
        self.omega_reference_motor = None
        self.centring_hwobj = None
        self.minikappa_correction_hwobj = None

        # Channels and commands -----------------------------------------------
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = None
        self.chan_head_type = None
        self.chan_fast_shutter_is_open = None
        self.chan_state = None
        self.chan_sync_move_motors = None
        self.chan_scintillator_position = None
        self.chan_capillary_position = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None
        self.cmd_get_omega_scan_limits = None
        self.cmd_save_centring_positions = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_pos = [0, 0]
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)
        self.x_calib = 0.000444
        self.y_calib = 0.000446
         
        self.pixels_per_mm_x = 1.0 / self.x_calib
        self.pixels_per_mm_y = 1.0 / self.y_calib
        self.beam_position = [200, 200]
        
        self.cancel_centring_methods = {}
        self.current_positions_dict = {'phiy'  : 0, 'phiz' : 0, 'sampx' : 0,
                                       'sampy' : 0, 'zoom' : 0, 'phi' : 17.6,
                                       'focus' : 0, 'kappa': 11, 'kappa_phi': 12,
                                       'beam_x': 0, 'beam_y': 0}
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        self.image_width = 400
        self.image_height = 400

        self.mount_mode = self.getProperty("sample_mount_mode")
        if self.mount_mode is None:
            self.mount_mode = "manual"

        self.equipment_ready()
Ejemplo n.º 3
0
    def __init__(self, *args):
        """
        Description:
        """ 
        GenericDiffractometer.__init__(self, *args)

        # Hardware objects ---------------------------------------------------- 
        self.zoom_motor_hwobj = None
        self.camera_hwobj = None
        self.omega_reference_motor = None
        self.centring_hwobj = None
        self.minikappa_correction_hwobj = None
        self.detector_distance_motor_hwobj = None

        # Channels and commands -----------------------------------------------
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = None
        self.chan_head_type = None
        self.chan_fast_shutter_is_open = None
        self.chan_state = None
        self.chan_sync_move_motors = None
        self.chan_scintillator_position = None
        self.chan_capillary_position = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None   
        self.cmd_get_omega_scan_limits = None
        self.cmd_save_centring_positions = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_pos  = [0, 0]
Ejemplo n.º 4
0
 def move_to_beam(self, x, y, omega=None):
     """Creates a new centring point based on all motors positions
     """  
     if self.current_phase != "BeamLocation":
         GenericDiffractometer.move_to_beam(self, x, y, omega) 
     else:
         logging.getLogger("HWR").debug("Diffractometer: Move to screen" +\
            " position disabled in BeamLocation phase.")
Ejemplo n.º 5
0
 def move_to_beam(self, x, y, omega=None):
     """Creates a new centring point based on all motors positions
     """
     if self.current_phase != "BeamLocation":
         GenericDiffractometer.move_to_beam(self, x, y, omega)
     else:
         logging.getLogger("HWR").debug("Diffractometer: Move to screen" +\
            " position disabled in BeamLocation phase.")
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)
        self.x_calib = 0.000444
        self.y_calib = 0.000446
        self.last_centred_position = [318, 238]

        self.pixels_per_mm_x = 1.0 / self.x_calib
        self.pixels_per_mm_y = 1.0 / self.y_calib
        self.beam_position = [318, 238]

        self.cancel_centring_methods = {}
        self.current_motor_positions = {
            'phiy': 1.0,
            'sampx': 0.0,
            'sampy': -1.0,
            'zoom': 8.53,
            'focus': -0.42,
            'phiz': 1.1,
            'phi': 311.1,
            'kappa': 11,
            'kappa_phi': 22.0
        }
        self.move_motors(self._get_random_centring_position())

        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        self.image_width = 400
        self.image_height = 400

        self.mount_mode = self.getProperty("sample_mount_mode")
        if self.mount_mode is None:
            self.mount_mode = "manual"

        self.equipment_ready()

        # TODO FFS get this cleared up - one function, one name
        self.getPositions = self.get_positions
        self.moveMotors = self.move_motors

        self.connect(self.motor_hwobj_dict['phi'], "positionChanged",
                     self.phi_motor_moved)
        self.connect(self.motor_hwobj_dict['phiy'], "positionChanged",
                     self.phiy_motor_moved)
        self.connect(self.motor_hwobj_dict['phiz'], "positionChanged",
                     self.phiz_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa'], "positionChanged",
                     self.kappa_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa_phi'], "positionChanged",
                     self.kappa_phi_motor_moved)
        self.connect(self.motor_hwobj_dict['sampx'], "positionChanged",
                     self.sampx_motor_moved)
        self.connect(self.motor_hwobj_dict['sampy'], "positionChanged",
                     self.sampy_motor_moved)
Ejemplo n.º 7
0
    def init(self):
        self.calibration = self.getObjectByRole("calibration")
        self.centring_hwobj = self.getObjectByRole('centring')
        if self.centring_hwobj is None:
            logging.getLogger("HWR").debug('EMBLMinidiff: Centring math is not defined')

	self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')

        self.phi_motor_hwobj = self.getObjectByRole('phi')
        self.phiz_motor_hwobj = self.getObjectByRole('phiz')
        self.phiy_motor_hwobj = self.getObjectByRole('phiy')
        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.focus_motor_hwobj = self.getObjectByRole('focus')
        self.sample_x_motor_hwobj = self.getObjectByRole('sampx')
        self.sample_y_motor_hwobj = self.getObjectByRole('sampy')

        if self.phi_motor_hwobj is not None:
            self.connect(self.phi_motor_hwobj, 'stateChanged', self.phi_motor_state_changed)
            self.connect(self.phi_motor_hwobj, "positionChanged", self.phi_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phi motor is not defined')

        if self.phiz_motor_hwobj is not None:
            self.connect(self.phiz_motor_hwobj, 'stateChanged', self.phiz_motor_state_changed)
            self.connect(self.phiz_motor_hwobj, 'positionChanged', self.phiz_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phiz motor is not defined')

        if self.phiy_motor_hwobj is not None:
            self.connect(self.phiy_motor_hwobj, 'stateChanged', self.phiy_motor_state_changed)
            self.connect(self.phiy_motor_hwobj, 'positionChanged', self.phiy_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phiy motor is not defined')

        if self.zoom_motor_hwobj is not None:
            self.connect(self.zoom_motor_hwobj, 'positionChanged', self.zoom_position_changed)
            self.connect(self.zoom_motor_hwobj, 'predefinedPositionChanged', self.zoom_motor_predefined_position_changed)
            self.connect(self.zoom_motor_hwobj, 'stateChanged', self.zoom_motor_state_changed)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Zoom motor is not defined')

        if self.sample_x_motor_hwobj is not None:
            self.connect(self.sample_x_motor_hwobj, 'stateChanged', self.sampleX_motor_state_changed)
            self.connect(self.sample_x_motor_hwobj, 'positionChanged', self.sampleX_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Sampx motor is not defined')

        if self.sample_y_motor_hwobj is not None:
            self.connect(self.sample_y_motor_hwobj, 'stateChanged', self.sampleY_motor_state_changed)
            self.connect(self.sample_y_motor_hwobj, 'positionChanged', self.sampleY_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Sampx motor is not defined')

        if self.focus_motor_hwobj is not None:
            self.connect(self.focus_motor_hwobj, 'positionChanged', self.focus_motor_moved)

        GenericDiffractometer.init(self)
Ejemplo n.º 8
0
 def start_auto_centring(self, *args, **kwargs):
     """
     Start manual centring. Overrides GenericDiffracometer method.
     Prepares diffractometer for manual centring.
     """
     if self.prepare_centring():
         GenericDiffractometer.start_auto_centring(self, *args, **kwargs)
     else:
         logging.getLogger("HWR").info(
             " Failed to prepare diffractometer for centring")
         self.invalidate_centring()
Ejemplo n.º 9
0
 def start_auto_centring(self, *args, **kwargs):
     """
     Start manual centring. Overrides GenericDiffracometer method.
     Prepares diffractometer for manual centring.
     """
     if self.prepare_centring():
         GenericDiffractometer.start_auto_centring(self, *args, **kwargs)
     else:
         logging.getLogger("HWR").info(
             " Failed to prepare diffractometer for centring"
         )
         self.invalidate_centring()
    def __init__(self, *args):
        """
        Descript. :
        """
        GenericDiffractometer.__init__(self, *args)

        self.phiMotor = None
        self.phizMotor = None
        self.phiyMotor = None
        self.lightMotor = None
        self.zoomMotor = None
        self.sampleXMotor = None
        self.sampleYMotor = None
        self.camera = None
    def __init__(self, *args):
        """
        Descript. :
        """
        GenericDiffractometer.__init__(self, *args)

        self.phiMotor = None
        self.phizMotor = None
        self.phiyMotor = None
        self.lightMotor = None
        self.zoomMotor = None
        self.sampleXMotor = None
        self.sampleYMotor = None
        self.camera = None

        self.connect(self, 'equipmentReady', self.equipmentReady)
        self.connect(self, 'equipmentNotReady', self.equipmentNotReady)
    def __init__(self, *args):
        """
        Descript. :
        """
        GenericDiffractometer.__init__(self, *args)

        self.phiMotor = None
        self.phizMotor = None
        self.phiyMotor = None
        self.lightMotor = None
        self.zoomMotor = None
        self.sampleXMotor = None
        self.sampleYMotor = None
        self.camera = None

        self.connect(self, 'equipmentReady', self.equipmentReady)
        self.connect(self, 'equipmentNotReady', self.equipmentNotReady)
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)
        self.x_calib = 0.000444
        self.y_calib = 0.000446

        self.pixels_per_mm_x = 1.0 / self.x_calib
        self.pixels_per_mm_y = 1.0 / self.y_calib
        self.beam_position = [200, 200]

        self.cancel_centring_methods = {}
        self.current_positions_dict = {
            'phiy': 0,
            'phiz': 0,
            'sampx': 0,
            'sampy': 0,
            'zoom': 0,
            'phi': 17.6,
            'focus': 0,
            'kappa': 0,
            'kappa_phi': 0,
            'beam_x': 0,
            'beam_y': 0
        }
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        self.image_width = 400
        self.image_height = 400

        self.equipmentReady()

        self.reversing_rotation = self.getProperty("reversingRotation")
        try:
            self.grid_direction = eval(self.getProperty("gridDirection"))
        except:
            self.grid_direction = {"fast": (0, 1), "slow": (1, 0)}

        try:
            self.phase_list = eval(self.getProperty("phaseList"))
        except:
            self.phase_list = ['demo']
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)
        self.x_calib = 0.000444
        self.y_calib = 0.000446
        self.last_centred_position = [200, 200]

        self.pixels_per_mm_x = 1.0 / self.x_calib
        self.pixels_per_mm_y = 1.0 / self.y_calib
        self.beam_position = [200, 200]

        self.cancel_centring_methods = {}
        self.current_positions_dict = {
            'phiy': 0,
            'phiz': 0,
            'sampx': 0,
            'sampy': 0,
            'zoom': 0,
            'phi': 17.6,
            'focus': 0,
            'kappa': 11,
            'kappa_phi': 12,
            'beam_x': 0,
            'beam_y': 0
        }
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        self.image_width = 400
        self.image_height = 400

        self.mount_mode = self.getProperty("sample_mount_mode")
        if self.mount_mode is None:
            self.mount_mode = "manual"

        self.equipment_ready()
    def __init__(self, *args):
        """
        Description:
        """
        GenericDiffractometer.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.phi_motor_hwobj = None
        self.phiz_motor_hwobj = None
        self.phiy_motor_hwobj = None
        self.zoom_motor_hwobj = None
        self.sample_x_motor_hwobj = None
        self.sample_y_motor_hwobj = None
        self.camera_hwobj = None
        self.focus_motor_hwobj = None
        self.kappa_motor_hwobj = None
        self.kappa_phi_motor_hwobj = None
        self.omega_reference_motor = None
        self.centring_hwobj = None
        self.minikappa_correction_hwobj = None

        # Channels and commands -----------------------------------------------
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = None
        self.chan_head_type = None
        self.chan_fast_shutter_is_open = None
        self.chan_state = None
        self.chan_sync_move_motors = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None
        self.cmd_get_omega_scan_limits = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_pos = [0, 0]

        self.connect(self, 'equipmentReady', self.equipmentReady)
        self.connect(self, 'equipmentNotReady', self.equipmentNotReady)
Ejemplo n.º 16
0
    def init(self):
        self.smargon = self.getObjectByRole("smargon")
        self.connect(self.smargon, "stateChanged", self.smargon_state_changed)

        self.lightarm_hwobj = self.getObjectByRole('lightarm')
        # self.centring_hwobj = self.getObjectByRole('centring')
 
        self.px1conf_ho = self.getObjectByRole('px1configuration')
        self.px1env_ho = self.getObjectByRole('px1environment')

        self.pixels_per_mm_x = 0
        self.pixels_per_mm_y = 0

        GenericDiffractometer.init(self)

        self.centring_methods = {
             GenericDiffractometer.CENTRING_METHOD_MANUAL: \
                 self.px1_manual_centring,
             GenericDiffractometer.CENTRING_METHOD_AUTO: \
                 self.start_automatic_centring,
             GenericDiffractometer.CENTRING_METHOD_MOVE_TO_BEAM: \
                 self.start_move_to_beam}
    def __init__(self, *args):
        """
        Description:
        """ 
        GenericDiffractometer.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.phi_motor_hwobj = None
        self.phiz_motor_hwobj = None
        self.phiy_motor_hwobj = None
        self.zoom_motor_hwobj = None
        self.sample_x_motor_hwobj = None
        self.sample_y_motor_hwobj = None
        self.camera_hwobj = None
        self.focus_motor_hwobj = None
        self.kappa_motor_hwobj = None
        self.kappa_phi_motor_hwobj = None
        self.omega_reference_motor = None
        self.centring_hwobj = None
        self.minikappa_correction_hwobj = None

        # Channels and commands -----------------------------------------------
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = None
        self.chan_head_type = None
        self.chan_fast_shutter_is_open = None
        self.chan_state = None
        self.chan_sync_move_motors = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None   
        self.cmd_get_omega_scan_limits = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_pos  = [0, 0]
       
        self.connect(self, 'equipmentReady', self.equipmentReady)
        self.connect(self, 'equipmentNotReady', self.equipmentNotReady)     
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)
        self.x_calib = 0.000444
        self.y_calib = 0.000446
         
        self.pixels_per_mm_x = 1.0 / self.x_calib
        self.pixels_per_mm_y = 1.0 / self.y_calib
        self.beam_position = [200, 200]
        
        self.cancel_centring_methods = {}
        self.current_positions_dict = {'phiy'  : 0, 'phiz' : 0, 'sampx' : 0,
                                       'sampy' : 0, 'zoom' : 0, 'phi' : 17.6,
                                       'focus' : 0, 'kappa': 0, 'kappa_phi': 0,
                                       'beam_x': 0, 'beam_y': 0} 
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        self.image_width = 400
        self.image_height = 400

        self.equipmentReady()

        self.reversing_rotation = self.getProperty("reversingRotation")
        try:
            self.grid_direction = eval(self.getProperty("gridDirection"))
        except:
            self.grid_direction = {"fast": (0, 1), "slow": (1, 0)}

        try:
            self.phase_list = eval(self.getProperty("phaseList"))
        except:
            self.phase_list = ['demo']
 def __init__(self, *args):
     """
     Descript. :
     """
     GenericDiffractometer.__init__(self, *args)
    def init(self):
        """
        Description:
        """
        GenericDiffractometer.init(self)
        self.centring_status = {"valid": False}

        self.chan_state = self.getChannelObject('State')
        if self.chan_state:
            self.current_state = self.chan_state.getValue()
            self.chan_state.connectSignal("update", self.state_changed)

        self.chan_calib_x = self.getChannelObject('CoaxCamScaleX')
        self.chan_calib_y = self.getChannelObject('CoaxCamScaleY')
        self.update_pixels_per_mm()

        self.chan_head_type = self.getChannelObject('HeadType')
        if self.chan_head_type is not None:
            self.head_type = self.chan_head_type.getValue()

        self.chan_current_phase = self.getChannelObject('CurrentPhase')
        if self.chan_current_phase is not None:
            self.connect(self.chan_current_phase, "update",
                         self.current_phase_changed)
        else:
            logging.getLogger("HWR").debug(
                'EMBLMinidiff: Current phase channel not defined')

        self.chan_fast_shutter_is_open = self.getChannelObject(
            'FastShutterIsOpen')
        if self.chan_fast_shutter_is_open is not None:
            self.chan_fast_shutter_is_open.connectSignal(
                "update", self.fast_shutter_state_changed)

        self.cmd_start_set_phase = self.getCommandObject('startSetPhase')
        self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')
        self.cmd_get_omega_scan_limits = self.getCommandObject(
            'getOmegaMotorDynamicScanLimits')

        self.centring_hwobj = self.getObjectByRole('centring')
        if self.centring_hwobj is None:
            logging.getLogger("HWR").debug(
                'EMBLMinidiff: Centring math is not defined')

        self.minikappa_correction_hwobj = self.getObjectByRole(
            'minikappa_correction')
        if self.minikappa_correction_hwobj is None:
            logging.getLogger("HWR").debug(
                'EMBLMinidiff: Minikappa correction is not defined')

        self.phi_motor_hwobj = self.getObjectByRole('phi')
        self.phiz_motor_hwobj = self.getObjectByRole('phiz')
        self.phiy_motor_hwobj = self.getObjectByRole('phiy')
        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.focus_motor_hwobj = self.getObjectByRole('focus')
        self.sample_x_motor_hwobj = self.getObjectByRole('sampx')
        self.sample_y_motor_hwobj = self.getObjectByRole('sampy')

        #if self.head_type == GenericDiffractometer.HEAD_TYPE_MINIKAPPA:
        if True:
            self.kappa_motor_hwobj = self.getObjectByRole('kappa')
            self.kappa_phi_motor_hwobj = self.getObjectByRole('kappa_phi')

            if self.kappa_motor_hwobj is not None:
                self.connect(self.kappa_motor_hwobj, 'stateChanged',
                             self.kappa_motor_state_changed)
                self.connect(self.kappa_motor_hwobj, "positionChanged",
                             self.kappa_motor_moved)
            else:
                logging.getLogger("HWR").error(
                    'EMBLMiniDiff: kappa motor is not defined')

            if self.kappa_phi_motor_hwobj is not None:
                self.connect(self.kappa_phi_motor_hwobj, 'stateChanged',
                             self.kappa_phi_motor_state_changed)
                self.connect(self.kappa_phi_motor_hwobj, 'positionChanged',
                             self.kappa_phi_motor_moved)
            else:
                logging.getLogger("HWR").error(
                    'EMBLMiniDiff: kappa phi motor is not defined')
        else:
            logging.getLogger("HWR").debug(
                'EMBLMinidiff: Kappa and Phi motors not initialized (Plate mode detected).'
            )

        if self.phi_motor_hwobj is not None:
            self.connect(self.phi_motor_hwobj, 'stateChanged',
                         self.phi_motor_state_changed)
            self.connect(self.phi_motor_hwobj, "positionChanged",
                         self.phi_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Phi motor is not defined')

        if self.phiz_motor_hwobj is not None:
            self.connect(self.phiz_motor_hwobj, 'stateChanged',
                         self.phiz_motor_state_changed)
            self.connect(self.phiz_motor_hwobj, 'positionChanged',
                         self.phiz_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Phiz motor is not defined')

        if self.phiy_motor_hwobj is not None:
            self.connect(self.phiy_motor_hwobj, 'stateChanged',
                         self.phiy_motor_state_changed)
            self.connect(self.phiy_motor_hwobj, 'positionChanged',
                         self.phiy_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Phiy motor is not defined')

        if self.zoom_motor_hwobj is not None:
            self.connect(self.zoom_motor_hwobj, 'positionChanged',
                         self.zoom_position_changed)
            self.connect(self.zoom_motor_hwobj, 'predefinedPositionChanged',
                         self.zoom_motor_predefined_position_changed)
            self.connect(self.zoom_motor_hwobj, 'stateChanged',
                         self.zoom_motor_state_changed)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Zoom motor is not defined')

        if self.sample_x_motor_hwobj is not None:
            self.connect(self.sample_x_motor_hwobj, 'stateChanged',
                         self.sampleX_motor_state_changed)
            self.connect(self.sample_x_motor_hwobj, 'positionChanged',
                         self.sampleX_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Sampx motor is not defined')

        if self.sample_y_motor_hwobj is not None:
            self.connect(self.sample_y_motor_hwobj, 'stateChanged',
                         self.sampleY_motor_state_changed)
            self.connect(self.sample_y_motor_hwobj, 'positionChanged',
                         self.sampleY_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'EMBLMiniDiff: Sampx motor is not defined')

        if self.focus_motor_hwobj is not None:
            self.connect(self.focus_motor_hwobj, 'positionChanged',
                         self.focus_motor_moved)

        try:
            self.omega_reference_par = eval(
                self.getProperty("omega_reference"))
            self.omega_reference_motor = self.getObjectByRole(
                self.omega_reference_par["motor_name"])
            if self.omega_reference_motor is not None:
                self.connect(self.omega_reference_motor, 'positionChanged',
                             self.omega_reference_motor_moved)
        except:
            logging.getLogger("HWR").warning(
                'EMBLMiniDiff: Omega axis is not defined')

        self.use_sc = self.getProperty("use_sample_changer")
Ejemplo n.º 21
0
    def init(self):
        """
        Description:
        """
        GenericDiffractometer.init(self)
        self.centring_status = {"valid": False}

        self.chan_state = self.getChannelObject('State')
        self.current_state = self.chan_state.getValue()
        self.chan_state.connectSignal("update", self.state_changed)

        self.chan_calib_x = self.getChannelObject('CoaxCamScaleX')
        self.chan_calib_y = self.getChannelObject('CoaxCamScaleY')
        self.update_pixels_per_mm()

        self.chan_head_type = self.getChannelObject('HeadType')
        self.head_type = self.chan_head_type.getValue()

        self.chan_current_phase = self.getChannelObject('CurrentPhase')
        self.connect(self.chan_current_phase, "update", self.current_phase_changed)

        self.chan_fast_shutter_is_open = self.getChannelObject('FastShutterIsOpen')
        self.chan_fast_shutter_is_open.connectSignal("update", self.fast_shutter_state_changed)
       
        self.chan_scintillator_position = self.getChannelObject('ScintillatorPosition')
        self.chan_capillary_position = self.getChannelObject('CapillaryPosition')

        self.cmd_start_set_phase = self.getCommandObject('startSetPhase')
        self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')
        self.cmd_get_omega_scan_limits = self.getCommandObject('getOmegaMotorDynamicScanLimits')
        self.cmd_save_centring_positions = self.getCommandObject('saveCentringPositions')

        self.centring_hwobj = self.getObjectByRole('centring')
        self.minikappa_correction_hwobj = self.getObjectByRole('minikappa_correction')
        self.detector_distance_motor_hwobj = self.getObjectByRole('detector_distance_motor')

        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.connect(self.zoom_motor_hwobj,
                     'positionChanged',
                     self.zoom_position_changed)
        self.connect(self.zoom_motor_hwobj,
                    'predefinedPositionChanged',
                    self.zoom_motor_predefined_position_changed)

        self.connect(self.motor_hwobj_dict['phi'],
                     "positionChanged",
                     self.phi_motor_moved) 
        self.connect(self.motor_hwobj_dict['phiy'],
                     "positionChanged",
                     self.phiy_motor_moved)
        self.connect(self.motor_hwobj_dict['phiz'],
                     "positionChanged",
                     self.phiz_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa'],
                     "positionChanged",
                     self.kappa_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa_phi'],
                     "positionChanged",
                     self.kappa_phi_motor_moved)
        self.connect(self.motor_hwobj_dict['sampx'],
                     "positionChanged",
                     self.sampx_motor_moved)
        self.connect(self.motor_hwobj_dict['sampy'],
                     "positionChanged",
                     self.sampy_motor_moved)

        self.omega_reference_par = eval(self.getProperty("omega_reference"))
        self.omega_reference_motor = self.getObjectByRole(self.omega_reference_par["motor_name"])
        self.connect(self.omega_reference_motor,
                     'positionChanged',
                     self.omega_reference_motor_moved)
Ejemplo n.º 22
0
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)

        self.cancel_centring_methods = {}
        self.current_positions_dict = {
            'phiy': 0,
            'phiz': 0,
            'sampx': 0,
            'sampy': 0,
            'zoom': 0,
            'phi': 17.6,
            'focus': 0,
            'kappa': 0,
            'kappa_phi': 0,
            'beam_x': 0,
            'beam_y': 0
        }
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        # Parameters from XML configuration
        self.image_width = self.defaultImageWidth
        self.image_height = self.defaultImageHeight
        self.default_omega_velocity = float(self.defaultOmegaVelocity)

        self.equipmentReady()

        # ---------------------------------------------------------------------
        # Beam-info
        self.beam_info_hwobj = self.getObjectByRole("beam_info")
        # Update beam position
        self.get_beam_position()

        # ---------------------------------------------------------------------
        # Camera
        self.camera_hwobj = self.getObjectByRole("camera")

        # ---------------------------------------------------------------------
        # Motors
        self.motor_omega_hwobj = self.getObjectByRole("omega")
        self.motor_goniox_hwobj = self.getObjectByRole("goniox")
        self.motor_sampx_hwobj = self.getObjectByRole("sampx")
        self.motor_sampy_hwobj = self.getObjectByRole("sampy")

        # Set default velocity
        self.set_omega_default_velocity()

        # Zoom
        self.motor_zoom_hwobj = self.getObjectByRole("zoom")

        # Connect signals to related objects
        if (self.motor_zoom_hwobj):
            self.motor_zoom_hwobj.connect('positionChanged',
                                          self.updatePixelsPerMM)

        # Update scale of pixels per mm
        self.pixels_per_mm_x = self.motor_zoom_hwobj.getPixelsPerMm(0)
        self.pixels_per_mm_y = self.motor_zoom_hwobj.getPixelsPerMm(0)

        #
        self.reversing_rotation = self.getProperty("reversingRotation")
        try:
            self.grid_direction = eval(self.getProperty("gridDirection"))
        except:
            self.grid_direction = {"fast": (0, 1), "slow": (1, 0)}

        try:
            self.phase_list = eval(self.getProperty("phaseList"))
        except:
            self.phase_list = ['demo']

        # Methods exported
        self.getPositions = self.get_positions
Ejemplo n.º 23
0
    def init(self):

        GenericDiffractometer.init(self)

        # to make it comaptible
        self.camera = self.camera_hwobj
 def __init__(self, *args):
     """
     Descript. :
     """
     GenericDiffractometer.__init__(self, *args)
Ejemplo n.º 25
0
 def get_pixels_per_mm(self):
     self.update_zoom_calibration()
     return GenericDiffractometer.get_pixels_per_mm(self)
    def init(self):
        """
        Description:
        """
        GenericDiffractometer.init(self)
        self.centring_status = {"valid": False}

        self.chan_state = self.getChannelObject('State')
        if self.chan_state:
            self.current_state = self.chan_state.getValue()
            self.chan_state.connectSignal("update", self.state_changed)

        self.chan_calib_x = self.getChannelObject('CoaxCamScaleX')
        self.chan_calib_y = self.getChannelObject('CoaxCamScaleY')
        self.update_pixels_per_mm()

        self.chan_head_type = self.getChannelObject('HeadType')
        if self.chan_head_type is not None:
            self.head_type = self.chan_head_type.getValue()

        self.chan_current_phase = self.getChannelObject('CurrentPhase')
        if self.chan_current_phase is not None:
            self.connect(self.chan_current_phase, "update", self.current_phase_changed)
        else:
            logging.getLogger("HWR").debug('EMBLMinidiff: Current phase channel not defined')

        self.chan_fast_shutter_is_open = self.getChannelObject('FastShutterIsOpen')
        if self.chan_fast_shutter_is_open is not None: 
            self.chan_fast_shutter_is_open.connectSignal("update", self.fast_shutter_state_changed)
       
        self.cmd_start_set_phase = self.getCommandObject('startSetPhase')
        self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')
        self.cmd_get_omega_scan_limits = self.getCommandObject('getOmegaMotorDynamicScanLimits')

        self.centring_hwobj = self.getObjectByRole('centring')
        if self.centring_hwobj is None:
            logging.getLogger("HWR").debug('EMBLMinidiff: Centring math is not defined')

        self.minikappa_correction_hwobj = self.getObjectByRole('minikappa_correction')
        if self.minikappa_correction_hwobj is None:
            logging.getLogger("HWR").debug('EMBLMinidiff: Minikappa correction is not defined')

        self.phi_motor_hwobj = self.getObjectByRole('phi')
        self.phiz_motor_hwobj = self.getObjectByRole('phiz')
        self.phiy_motor_hwobj = self.getObjectByRole('phiy')
        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.focus_motor_hwobj = self.getObjectByRole('focus')
        self.sample_x_motor_hwobj = self.getObjectByRole('sampx')
        self.sample_y_motor_hwobj = self.getObjectByRole('sampy')
       
        #if self.head_type == GenericDiffractometer.HEAD_TYPE_MINIKAPPA:
        if True:
            self.kappa_motor_hwobj = self.getObjectByRole('kappa')
            self.kappa_phi_motor_hwobj = self.getObjectByRole('kappa_phi')

            if self.kappa_motor_hwobj is not None:
                self.connect(self.kappa_motor_hwobj, 'stateChanged', self.kappa_motor_state_changed)
                self.connect(self.kappa_motor_hwobj, "positionChanged", self.kappa_motor_moved)
            else:
                logging.getLogger("HWR").error('EMBLMiniDiff: kappa motor is not defined')

            if self.kappa_phi_motor_hwobj is not None:
                self.connect(self.kappa_phi_motor_hwobj, 'stateChanged', self.kappa_phi_motor_state_changed)
                self.connect(self.kappa_phi_motor_hwobj, 'positionChanged', self.kappa_phi_motor_moved)
            else:
                logging.getLogger("HWR").error('EMBLMiniDiff: kappa phi motor is not defined')
        else:
            logging.getLogger("HWR").debug('EMBLMinidiff: Kappa and Phi motors not initialized (Plate mode detected).')
    
        if self.phi_motor_hwobj is not None:
            self.connect(self.phi_motor_hwobj, 'stateChanged', self.phi_motor_state_changed)
            self.connect(self.phi_motor_hwobj, "positionChanged", self.phi_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phi motor is not defined')

        if self.phiz_motor_hwobj is not None:
            self.connect(self.phiz_motor_hwobj, 'stateChanged', self.phiz_motor_state_changed)
            self.connect(self.phiz_motor_hwobj, 'positionChanged', self.phiz_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phiz motor is not defined')

        if self.phiy_motor_hwobj is not None:
            self.connect(self.phiy_motor_hwobj, 'stateChanged', self.phiy_motor_state_changed)
            self.connect(self.phiy_motor_hwobj, 'positionChanged', self.phiy_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Phiy motor is not defined')

        if self.zoom_motor_hwobj is not None:
            self.connect(self.zoom_motor_hwobj, 'positionChanged', self.zoom_position_changed)
            self.connect(self.zoom_motor_hwobj, 'predefinedPositionChanged', self.zoom_motor_predefined_position_changed)
            self.connect(self.zoom_motor_hwobj, 'stateChanged', self.zoom_motor_state_changed)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Zoom motor is not defined')

        if self.sample_x_motor_hwobj is not None:
            self.connect(self.sample_x_motor_hwobj, 'stateChanged', self.sampleX_motor_state_changed)
            self.connect(self.sample_x_motor_hwobj, 'positionChanged', self.sampleX_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Sampx motor is not defined')

        if self.sample_y_motor_hwobj is not None:
            self.connect(self.sample_y_motor_hwobj, 'stateChanged', self.sampleY_motor_state_changed)
            self.connect(self.sample_y_motor_hwobj, 'positionChanged', self.sampleY_motor_moved)
        else:
            logging.getLogger("HWR").error('EMBLMiniDiff: Sampx motor is not defined')

        if self.focus_motor_hwobj is not None:
            self.connect(self.focus_motor_hwobj, 'positionChanged', self.focus_motor_moved)

        try:
            self.omega_reference_par = eval(self.getProperty("omega_reference"))
            self.omega_reference_motor = self.getObjectByRole(self.omega_reference_par["motor_name"])
            if self.omega_reference_motor is not None:
                self.connect(self.omega_reference_motor, 'positionChanged', self.omega_reference_motor_moved)
        except:
            logging.getLogger("HWR").warning('EMBLMiniDiff: Omega axis is not defined')

        self.use_sc = self.getProperty("use_sample_changer")
Ejemplo n.º 27
0
    def init(self):

        self.calibration = self.getObjectByRole("calibration")

        self.centring_hwobj = self.getObjectByRole('centring')
        self.super_hwobj = self.getObjectByRole('beamline-supervisor')

        if self.centring_hwobj is None:
            logging.getLogger("HWR").debug(
                'ALBAMinidiff: Centring math is not defined')

        if self.super_hwobj is not None:
            self.connect(self.super_hwobj, 'stateChanged',
                         self.supervisor_state_changed)
            self.connect(self.super_hwobj, 'phaseChanged',
                         self.supervisor_phase_changed)

        self.state_channel = self.getChannelObject("State")
        self.connect(self.state_channel, "update", self.state_changed)
        # This is not used
        self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')

        self.phi_motor_hwobj = self.getObjectByRole('phi')
        self.phiz_motor_hwobj = self.getObjectByRole('phiz')
        self.phiy_motor_hwobj = self.getObjectByRole('phiy')
        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.focus_motor_hwobj = self.getObjectByRole('focus')
        self.sample_x_motor_hwobj = self.getObjectByRole('sampx')
        self.sample_y_motor_hwobj = self.getObjectByRole('sampy')

        if self.phi_motor_hwobj is not None:
            self.connect(self.phi_motor_hwobj, 'stateChanged',
                         self.phi_motor_state_changed)
            self.connect(self.phi_motor_hwobj, "positionChanged",
                         self.phi_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Phi motor is not defined')

        if self.phiz_motor_hwobj is not None:
            self.connect(self.phiz_motor_hwobj, 'stateChanged',
                         self.phiz_motor_state_changed)
            self.connect(self.phiz_motor_hwobj, 'positionChanged',
                         self.phiz_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Phiz motor is not defined')

        if self.phiy_motor_hwobj is not None:
            self.connect(self.phiy_motor_hwobj, 'stateChanged',
                         self.phiy_motor_state_changed)
            self.connect(self.phiy_motor_hwobj, 'positionChanged',
                         self.phiy_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Phiy motor is not defined')

        if self.zoom_motor_hwobj is not None:
            self.connect(self.zoom_motor_hwobj, 'positionChanged',
                         self.zoom_position_changed)
            self.connect(self.zoom_motor_hwobj, 'predefinedPositionChanged',
                         self.zoom_motor_predefined_position_changed)
            self.connect(self.zoom_motor_hwobj, 'stateChanged',
                         self.zoom_motor_state_changed)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Zoom motor is not defined')

        if self.sample_x_motor_hwobj is not None:
            self.connect(self.sample_x_motor_hwobj, 'stateChanged',
                         self.sampleX_motor_state_changed)
            self.connect(self.sample_x_motor_hwobj, 'positionChanged',
                         self.sampleX_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Sampx motor is not defined')

        if self.sample_y_motor_hwobj is not None:
            self.connect(self.sample_y_motor_hwobj, 'stateChanged',
                         self.sampleY_motor_state_changed)
            self.connect(self.sample_y_motor_hwobj, 'positionChanged',
                         self.sampleY_motor_moved)
        else:
            logging.getLogger("HWR").error(
                'ALBAMiniDiff: Sampx motor is not defined')

        if self.focus_motor_hwobj is not None:
            self.connect(self.focus_motor_hwobj, 'positionChanged',
                         self.focus_motor_moved)

        GenericDiffractometer.init(self)

        queue_model_objects.CentredPosition.\
            set_diffractometer_motor_names("phi", "phiy", "phiz", "sampx", "sampy", "kappa")
Ejemplo n.º 28
0
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)

        self.cancel_centring_methods = {}
        self.current_positions_dict = {'phiy'  : 0, 'phiz' : 0, 'sampx' : 0,
                                       'sampy' : 0, 'zoom' : 0, 'phi' : 17.6,
                                       'focus' : 0, 'kappa': 0, 'kappa_phi': 0,
                                       'beam_x': 0, 'beam_y': 0} 
        self.current_state_dict = {}
        self.centring_status = {"valid": False}
        self.centring_time = 0

        # Parameters from XML configuration
        self.image_width = self.defaultImageWidth
        self.image_height = self.defaultImageHeight
        self.default_omega_velocity = float(self.defaultOmegaVelocity)

        self.equipmentReady()

        # ---------------------------------------------------------------------
        # Beam-info
        self.beam_info_hwobj = self.getObjectByRole("beam_info")
        # Update beam position
        self.get_beam_position()

        # ---------------------------------------------------------------------
        # Camera
        self.camera_hwobj = self.getObjectByRole("camera")

        # ---------------------------------------------------------------------
        # Motors
        self.motor_omega_hwobj = self.getObjectByRole("omega")
        self.motor_goniox_hwobj = self.getObjectByRole("goniox")
        self.motor_sampx_hwobj = self.getObjectByRole("sampx")
        self.motor_sampy_hwobj = self.getObjectByRole("sampy")

        # Set default velocity
        self.set_omega_default_velocity()

        # Zoom
        self.motor_zoom_hwobj = self.getObjectByRole("zoom")

        # Connect signals to related objects
        if (self.motor_zoom_hwobj):
            self.motor_zoom_hwobj.connect('positionChanged', self.updatePixelsPerMM)

        # Update scale of pixels per mm
        self.pixels_per_mm_x = self.motor_zoom_hwobj.getPixelsPerMm(0)
        self.pixels_per_mm_y = self.motor_zoom_hwobj.getPixelsPerMm(0)

        #
        self.reversing_rotation = self.getProperty("reversingRotation")
        try:
            self.grid_direction = eval(self.getProperty("gridDirection"))
        except:
            self.grid_direction = {"fast": (0, 1), "slow": (1, 0)}

        try:
            self.phase_list = eval(self.getProperty("phaseList"))
        except:
            self.phase_list = ['demo']

        # Methods exported
        self.getPositions = self.get_positions
Ejemplo n.º 29
0
    def init(self):
        """
        Description:
        """
        GenericDiffractometer.init(self)
        self.centring_status = {"valid": False}

        self.chan_state = self.getChannelObject('State')
        self.current_state = self.chan_state.getValue()
        self.chan_state.connectSignal("update", self.state_changed)

        self.chan_calib_x = self.getChannelObject('CoaxCamScaleX')
        self.chan_calib_y = self.getChannelObject('CoaxCamScaleY')
        self.update_pixels_per_mm()

        self.chan_head_type = self.getChannelObject('HeadType')
        self.head_type = self.chan_head_type.getValue()

        self.chan_current_phase = self.getChannelObject('CurrentPhase')
        self.connect(self.chan_current_phase, "update",
                     self.current_phase_changed)

        self.chan_fast_shutter_is_open = self.getChannelObject(
            'FastShutterIsOpen')
        self.chan_fast_shutter_is_open.connectSignal(
            "update", self.fast_shutter_state_changed)

        self.chan_scintillator_position = self.getChannelObject(
            'ScintillatorPosition')
        self.chan_capillary_position = self.getChannelObject(
            'CapillaryPosition')

        self.cmd_start_set_phase = self.getCommandObject('startSetPhase')
        self.cmd_start_auto_focus = self.getCommandObject('startAutoFocus')
        self.cmd_get_omega_scan_limits = self.getCommandObject(
            'getOmegaMotorDynamicScanLimits')
        self.cmd_save_centring_positions = self.getCommandObject(
            'saveCentringPositions')

        self.centring_hwobj = self.getObjectByRole('centring')
        self.minikappa_correction_hwobj = self.getObjectByRole(
            'minikappa_correction')

        self.zoom_motor_hwobj = self.getObjectByRole('zoom')
        self.connect(self.zoom_motor_hwobj, 'positionChanged',
                     self.zoom_position_changed)
        self.connect(self.zoom_motor_hwobj, 'predefinedPositionChanged',
                     self.zoom_motor_predefined_position_changed)

        self.connect(self.motor_hwobj_dict['phi'], "positionChanged",
                     self.phi_motor_moved)
        self.connect(self.motor_hwobj_dict['phiy'], "positionChanged",
                     self.phiy_motor_moved)
        self.connect(self.motor_hwobj_dict['phiz'], "positionChanged",
                     self.phiz_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa'], "positionChanged",
                     self.kappa_motor_moved)
        self.connect(self.motor_hwobj_dict['kappa_phi'], "positionChanged",
                     self.kappa_phi_motor_moved)
        self.connect(self.motor_hwobj_dict['sampx'], "positionChanged",
                     self.sampx_motor_moved)
        self.connect(self.motor_hwobj_dict['sampy'], "positionChanged",
                     self.sampy_motor_moved)

        self.omega_reference_par = eval(self.getProperty("omega_reference"))
        self.omega_reference_motor = self.getObjectByRole(
            self.omega_reference_par["motor_name"])
        self.connect(self.omega_reference_motor, 'positionChanged',
                     self.omega_reference_motor_moved)

        self.use_sc = self.getProperty("use_sample_changer")
Ejemplo n.º 30
0
    def init(self):
        """
        Description:
        """
        GenericDiffractometer.init(self)
        self.centring_status = {"valid": False}

        self.chan_state = self.getChannelObject("State")
        self.chan_status = self.getChannelObject("Status")

        self.current_state = self.chan_state.getValue()
        self.current_status = self.chan_status.getValue()

        self.chan_state.connectSignal("update", self.state_changed)
        self.chan_status.connectSignal("update", self.status_changed)

        self.chan_calib_x = self.getChannelObject("CoaxCamScaleX")
        self.chan_calib_y = self.getChannelObject("CoaxCamScaleY")
        self.update_pixels_per_mm()

        self.chan_head_type = self.getChannelObject("HeadType")
        self.head_type = self.chan_head_type.getValue()

        self.chan_current_phase = self.getChannelObject("CurrentPhase")
        self.connect(self.chan_current_phase, "update", self.current_phase_changed)

        self.chan_fast_shutter_is_open = self.getChannelObject("FastShutterIsOpen")
        self.chan_fast_shutter_is_open.connectSignal(
            "update", self.fast_shutter_state_changed
        )

        self.chan_scintillator_position = self.getChannelObject("ScintillatorPosition")
        self.chan_capillary_position = self.getChannelObject("CapillaryPosition")

        self.cmd_start_set_phase = self.getCommandObject("startSetPhase")
        self.cmd_start_auto_focus = self.getCommandObject("startAutoFocus")
        self.cmd_get_omega_scan_limits = self.getCommandObject(
            "getOmegaMotorDynamicScanLimits"
        )
        self.cmd_save_centring_positions = self.getCommandObject(
            "saveCentringPositions"
        )

        self.centring_hwobj = self.getObjectByRole("centring")
        self.minikappa_correction_hwobj = self.getObjectByRole("minikappa_correction")
        self.detector_distance_motor_hwobj = self.getObjectByRole(
            "detector_distance_motor"
        )

        self.zoom_motor_hwobj = self.getObjectByRole("zoom")
        self.connect(
            self.zoom_motor_hwobj, "positionChanged", self.zoom_position_changed
        )
        self.connect(
            self.zoom_motor_hwobj,
            "predefinedPositionChanged",
            self.zoom_motor_predefined_position_changed,
        )

        self.connect(
            self.motor_hwobj_dict["phi"], "positionChanged", self.phi_motor_moved
        )
        self.connect(
            self.motor_hwobj_dict["phiy"], "positionChanged", self.phiy_motor_moved
        )
        self.connect(
            self.motor_hwobj_dict["phiz"], "positionChanged", self.phiz_motor_moved
        )
        self.connect(
            self.motor_hwobj_dict["kappa"], "positionChanged", self.kappa_motor_moved
        )
        self.connect(
            self.motor_hwobj_dict["kappa_phi"],
            "positionChanged",
            self.kappa_phi_motor_moved,
        )
        self.connect(
            self.motor_hwobj_dict["sampx"], "positionChanged", self.sampx_motor_moved
        )
        self.connect(
            self.motor_hwobj_dict["sampy"], "positionChanged", self.sampy_motor_moved
        )

        self.omega_reference_par = eval(self.getProperty("omega_reference"))
        self.omega_reference_motor = self.getObjectByRole(
            self.omega_reference_par["motor_name"]
        )
        self.connect(
            self.omega_reference_motor,
            "positionChanged",
            self.omega_reference_motor_moved,
        )
Ejemplo n.º 31
0
 def __init__(self, *args):
     GenericDiffractometer.__init__(self, *args)
     self.centring_hwobj = None
Ejemplo n.º 32
0
    def init(self):

        self.calibration = self.getObjectByRole("calibration")

        self.centring_hwobj = self.getObjectByRole("centring")
        self.super_hwobj = self.getObjectByRole("beamline-supervisor")

        if self.centring_hwobj is None:
            logging.getLogger("HWR").debug("ALBAMinidiff: Centring math is not defined")

        if self.super_hwobj is not None:
            self.connect(
                self.super_hwobj, "stateChanged", self.supervisor_state_changed
            )
            self.connect(
                self.super_hwobj, "phaseChanged", self.supervisor_phase_changed
            )

        self.state_channel = self.getChannelObject("State")
        self.connect(self.state_channel, "update", self.state_changed)
        # This is not used
        self.cmd_start_auto_focus = self.getCommandObject("startAutoFocus")

        self.phi_motor_hwobj = self.getObjectByRole("phi")
        self.phiz_motor_hwobj = self.getObjectByRole("phiz")
        self.phiy_motor_hwobj = self.getObjectByRole("phiy")
        self.zoom_motor_hwobj = self.getObjectByRole("zoom")
        self.focus_motor_hwobj = self.getObjectByRole("focus")
        self.sample_x_motor_hwobj = self.getObjectByRole("sampx")
        self.sample_y_motor_hwobj = self.getObjectByRole("sampy")

        if self.phi_motor_hwobj is not None:
            self.connect(
                self.phi_motor_hwobj, "stateChanged", self.phi_motor_state_changed
            )
            self.connect(self.phi_motor_hwobj, "positionChanged", self.phi_motor_moved)
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Phi motor is not defined")

        if self.phiz_motor_hwobj is not None:
            self.connect(
                self.phiz_motor_hwobj, "stateChanged", self.phiz_motor_state_changed
            )
            self.connect(
                self.phiz_motor_hwobj, "positionChanged", self.phiz_motor_moved
            )
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Phiz motor is not defined")

        if self.phiy_motor_hwobj is not None:
            self.connect(
                self.phiy_motor_hwobj, "stateChanged", self.phiy_motor_state_changed
            )
            self.connect(
                self.phiy_motor_hwobj, "positionChanged", self.phiy_motor_moved
            )
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Phiy motor is not defined")

        if self.zoom_motor_hwobj is not None:
            self.connect(
                self.zoom_motor_hwobj, "positionChanged", self.zoom_position_changed
            )
            self.connect(
                self.zoom_motor_hwobj,
                "predefinedPositionChanged",
                self.zoom_motor_predefined_position_changed,
            )
            self.connect(
                self.zoom_motor_hwobj, "stateChanged", self.zoom_motor_state_changed
            )
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Zoom motor is not defined")

        if self.sample_x_motor_hwobj is not None:
            self.connect(
                self.sample_x_motor_hwobj,
                "stateChanged",
                self.sampleX_motor_state_changed,
            )
            self.connect(
                self.sample_x_motor_hwobj, "positionChanged", self.sampleX_motor_moved
            )
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Sampx motor is not defined")

        if self.sample_y_motor_hwobj is not None:
            self.connect(
                self.sample_y_motor_hwobj,
                "stateChanged",
                self.sampleY_motor_state_changed,
            )
            self.connect(
                self.sample_y_motor_hwobj, "positionChanged", self.sampleY_motor_moved
            )
        else:
            logging.getLogger("HWR").error("ALBAMiniDiff: Sampx motor is not defined")

        if self.focus_motor_hwobj is not None:
            self.connect(
                self.focus_motor_hwobj, "positionChanged", self.focus_motor_moved
            )

        GenericDiffractometer.init(self)

        queue_model_objects.CentredPosition.set_diffractometer_motor_names(
            "phi", "phiy", "phiz", "sampx", "sampy", "kappa"
        )