Esempio n. 1
0
    def __init__(self, *args):
        """Based on the GenericDiffractometer without centering motors"""

        GenericDiffractometer.__init__(self, *args)

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

        # Channels and commands -----------------------------------------------
        self.chan_beamstop_position = None
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = 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.chan_status = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None
        self.cmd_save_centring_positions = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_par = None
        self.omega_reference_pos = [0, 0]
        self.current_state = None
        self.fast_shutter_is_open = None
    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_status = 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]
        self.reference_pos = [680, 512]
Esempio n. 3
0
    def __init__(self, *args):
        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_par = None
        self.omega_reference_pos = [0, 0]
        self.imaging_pixels_per_mm = [0, 0]

        self.current_phase = None
Esempio n. 4
0
    def __init__(self, *args):
        """Based on the GenericDiffractometer without centering motors"""

        GenericDiffractometer.__init__(self, *args)

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

        # Channels and commands -----------------------------------------------
        self.chan_beamstop_position = None
        self.chan_calib_x = None
        self.chan_calib_y = None
        self.chan_current_phase = 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.chan_status = None
        self.cmd_start_set_phase = None
        self.cmd_start_auto_focus = None
        self.cmd_save_centring_positions = None

        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_par = None
        self.omega_reference_pos = [0, 0]
        self.current_state = None
        self.fast_shutter_is_open = None
Esempio n. 5
0
    def init(self):

        GenericDiffractometer.init(self)

        self.front_light = self.getObjectByRole("frontlight")
        self.back_light = self.getObjectByRole("backlight")
        self.back_light_switch = self.getObjectByRole("backlightswitch")
        self.front_light_switch = self.getObjectByRole("frontlightswitch")
Esempio n. 6
0
 def __init__(self, *args):
     """
     Description:
     """
     GenericDiffractometer.__init__(self, *args)
     # Compatibility line
     self.C3D_MODE = GenericDiffractometer.CENTRING_METHOD_AUTO
     self.MANUAL3CLICK_MODE = "Manual 3-click"
Esempio n. 7
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 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 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 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()
Esempio n. 11
0
    def __init__(self, *args):
        """
        Description:
        """
        GenericDiffractometer.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.zoom_motor_hwobj = None
        self.omega_reference_motor = None
        self.centring_hwobj = None
        self.minikappa_correction_hwobj = None
        self.nclicks = None
        self.step = None
        self.centring_method = None
        self.collecting = False

        # 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_status = 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
        self.centring_time = None
        # Internal values -----------------------------------------------------
        self.use_sc = False
        self.omega_reference_pos = [0, 0]
        self.reference_pos = [680, 512]

        self.goniometer = goniometer()
        self.camera = camera()
        self.detector = detector()

        self.md2_to_mxcube = dict(
            [(key, value) for key, value in self.motor_name_mapping]
        )
        self.mxcube_to_md2 = dict(
            [(value, key) for key, value in self.motor_name_mapping]
        )

        self.log = logging.getLogger("HWR")
Esempio n. 12
0
    def init(self):
        """Initiates variables"""

        GenericDiffractometer.init(self)

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

        self.chan_status = self.getChannelObject("Status")
        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_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.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.chan_beamstop_position = self.getChannelObject("BeamstopPosition")
Esempio n. 13
0
    def init(self):
        """Initiates variables"""

        GenericDiffractometer.init(self)

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

        self.chan_status = self.getChannelObject("Status")
        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_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.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.chan_beamstop_position = self.getChannelObject("BeamstopPosition")
Esempio n. 14
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):
        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,
        }
Esempio n. 16
0
    def init(self):
        """
        Descript. :
        """
        GenericDiffractometer.init(self)

        self.current_phase = GenericDiffractometer.PHASE_CENTRING

        self.cancel_centring_methods = {}

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

        #using sample_centring module
        self.centring_phi = sample_centring.CentringMotor(
            self.motor_hwobj_dict["phi"],
            direction=-1,
        )
        self.centring_phiz = sample_centring.CentringMotor(
            self.motor_hwobj_dict["phiz"], direction=1, units='microns')
        self.centring_phiy = sample_centring.CentringMotor(
            self.motor_hwobj_dict["phiy"],
            direction=1,
            units='microns',
        )
        self.centring_sampx = sample_centring.CentringMotor(
            self.motor_hwobj_dict["sampx"],
            units='microns',
        )
        self.centring_sampy = sample_centring.CentringMotor(
            self.motor_hwobj_dict["sampy"],
            units='microns',
        )

        self.update_zoom_calibration()
Esempio n. 17
0
 def __init__(self, *args):
     GenericDiffractometer.__init__(self, *args)
     self.centring_hwobj = None
Esempio n. 18
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.get_command_object("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, "valueChanged",
                         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, "valueChanged",
                         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, "valueChanged",
                         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, "valueChanged",
                         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, "valueChanged",
                         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, "valueChanged",
                         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, "valueChanged",
                         self.focus_motor_moved)

        GenericDiffractometer.init(self)
Esempio n. 19
0
    def init(self):

        self.calibration = self.get_object_by_role("calibration")

        self.centring_hwobj = self.get_object_by_role("centring")
        self.super_hwobj = self.get_object_by_role("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.get_channel_object("State")
        self.connect(self.state_channel, "update", self.state_changed)
        # This is not used
        self.cmd_start_auto_focus = self.get_command_object("startAutoFocus")

        self.phi_motor_hwobj = self.get_object_by_role("phi")
        self.phiz_motor_hwobj = self.get_object_by_role("phiz")
        self.phiy_motor_hwobj = self.get_object_by_role("phiy")
        self.zoom_motor_hwobj = self.get_object_by_role("zoom")
        self.focus_motor_hwobj = self.get_object_by_role("focus")
        self.sample_x_motor_hwobj = self.get_object_by_role("sampx")
        self.sample_y_motor_hwobj = self.get_object_by_role("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, "valueChanged", 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, "valueChanged", 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, "valueChanged", 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, "valueChanged", 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, "valueChanged", 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, "valueChanged", 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, "valueChanged", self.focus_motor_moved)

        GenericDiffractometer.init(self)

        queue_model_objects.CentredPosition.set_diffractometer_motor_names(
            "phi", "phiy", "phiz", "sampx", "sampy", "kappa"
        )
 def get_pixels_per_mm(self):
     self.update_zoom_calibration()
     return GenericDiffractometer.get_pixels_per_mm(self)
    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"
        )
    def init(self):
        """
        Descript. :
        """
        # self.image_width = 100
        # self.image_height = 100

        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.current_phase = GenericDiffractometer.PHASE_CENTRING

        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.get_property("sample_mount_mode")
        if self.mount_mode is None:
            self.mount_mode = "manual"

        self.equipment_ready()

        self.connect(self.motor_hwobj_dict["phi"], "valueChanged",
                     self.phi_motor_moved)
        self.connect(self.motor_hwobj_dict["phiy"], "valueChanged",
                     self.phiy_motor_moved)
        self.connect(self.motor_hwobj_dict["phiz"], "valueChanged",
                     self.phiz_motor_moved)
        self.connect(self.motor_hwobj_dict["kappa"], "valueChanged",
                     self.kappa_motor_moved)
        self.connect(
            self.motor_hwobj_dict["kappa_phi"],
            "valueChanged",
            self.kappa_phi_motor_moved,
        )
        self.connect(self.motor_hwobj_dict["sampx"], "valueChanged",
                     self.sampx_motor_moved)
        self.connect(self.motor_hwobj_dict["sampy"], "valueChanged",
                     self.sampy_motor_moved)
Esempio n. 23
0
    def init(self):

        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_status = self.getChannelObject("Status")
        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.imaging_centring_hwobj = self.getObjectByRole("imaging-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,
        )

        # self.use_sc = self.getProperty("use_sample_changer")
        self.imaging_pixels_per_mm = [1, 1]
        self.centring_methods[
            EMBLMiniDiff.CENTRING_METHOD_IMAGING] = self.start_imaging_centring
        self.centring_methods[
            EMBLMiniDiff.
            CENTRING_METHOD_IMAGING_N] = self.start_imaging_centring_n
Esempio n. 24
0
 def __init__(self, *args):
     """
     Descript. :
     """
     self.beam_position = [680, 512]
     GenericDiffractometer.__init__(self, *args)
    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,
        )
Esempio n. 26
0
 def __init__(self, *args):
     """
     Description:
     """
     GenericDiffractometer.__init__(self, *args)
 def __init__(self, *args):
     GenericDiffractometer.__init__(self, *args)
     self.centring_hwobj = None
    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)
Esempio n. 29
0
    def init(self):
        """
        Descript. :
        """
        # self.image_width = 100
        # self.image_height = 100

        GenericDiffractometer.init(self)
        # Bzoom: 1.86 um/pixel (or 0.00186 mm/pixel) at minimum zoom
        self.x_calib = 0.00186
        self.y_calib = 0.00186
        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
        if "zoom" not in self.motor_hwobj_dict.keys():
            self.motor_hwobj_dict["zoom"] = self.getObjectByRole("zoom")
        calibration_x = self.zoom.getProperty("mm_per_pixel_x")
        calibration_y = self.zoom.getProperty("mm_per_pixel_y")
        self.zoom_calibration_x = ast.literal_eval(calibration_x)
        self.zoom_calibration_y = ast.literal_eval(calibration_y)

        self.beam_position = [318, 238]

        self.current_phase = GenericDiffractometer.PHASE_CENTRING

        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)
 def __init__(self, *args):
     """
     Descript. :
     """
     GenericDiffractometer.__init__(self, *args)
Esempio n. 31
0
 def get_pixels_per_mm(self):
     self.update_zoom_calibration()
     return GenericDiffractometer.get_pixels_per_mm(self)
Esempio n. 32
0
    def init(self):

        GenericDiffractometer.init(self)

        self.front_light = self.get_object_by_role("frontlight")
        self.back_light = self.get_object_by_role("backlight")
        self.back_light_switch = self.get_object_by_role("backlightswitch")
        self.front_light_switch = self.get_object_by_role("frontlightswitch")

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

        self.phi_motor_hwobj = self.motor_hwobj_dict["phi"]
        self.phiz_motor_hwobj = self.motor_hwobj_dict["phiz"]
        self.phiy_motor_hwobj = self.motor_hwobj_dict["phiy"]
        self.zoom_motor_hwobj = self.motor_hwobj_dict["zoom"]
        self.focus_motor_hwobj = self.motor_hwobj_dict["focus"]
        self.sample_x_motor_hwobj = self.motor_hwobj_dict["sampx"]
        self.sample_y_motor_hwobj = self.motor_hwobj_dict["sampy"]
        try:
            self.kappa_motor_hwobj = self.motor_hwobj_dict["kappa"]
        except Exception:
            self.kappa_motor_hwobj = None
        try:
            self.kappa_phi_motor_hwobj = self.motor_hwobj_dict["kappa_phi"]
        except Exception:
            self.kappa_phi_motor_hwobj = None

        self.cent_vertical_pseudo_motor = None
        try:
            self.cent_vertical_pseudo_motor = self.add_channel(
                {
                    "type": "exporter",
                    "name": "CentringTableVerticalPositionPosition"
                },
                "CentringTableVerticalPosition",
            )
            if self.cent_vertical_pseudo_motor is not None:
                self.connect(self.cent_vertcial_pseudo_motor, "update",
                             self.centring_motor_moved)
        except Exception:
            logging.getLogger("HWR").warning(
                "Cannot initialize CentringTableVerticalPosition")

        try:
            use_sc = self.get_property("use_sc")
            self.set_use_sc(use_sc)
        except Exception:
            logging.getLogger("HWR").debug("Cannot set sc mode, use_sc: ",
                                           str(use_sc))

        try:
            self.zoom_centre = eval(self.get_property("zoom_centre"))
            zoom = HWR.beamline.sample_view.camera.get_image_zoom()
            if zoom is not None:
                self.zoom_centre["x"] = self.zoom_centre["x"] * zoom
                self.zoom_centre["y"] = self.zoom_centre["y"] * zoom
            self.beam_position = [self.zoom_centre["x"], self.zoom_centre["y"]]
            HWR.beamline.beam.set_beam_position(self.beam_position)
        except Exception:
            self.zoom_centre = {"x": 0, "y": 0}
            logging.getLogger("HWR").warning("BIOMAXMD3: " +
                                             "zoom centre not configured")
    def init(self):
        """
        Descript. :
        """
        self.image_width = 100
        self.image_height = 100

        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.current_phase = GenericDiffractometer.PHASE_CENTRING

        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
        )