Exemple #1
0
    def new_centred_position(self, state, centring_status):
        """
        Adds a new centred position, connected to the brick which handles
        centring (HutchMenuBrick).
        """
        p_dict = {}

        if "motors" in centring_status and "extraMotors" in centring_status:

            p_dict = dict(centring_status["motors"],
                          **centring_status["extraMotors"])

        elif "motors" in centring_status:
            p_dict = dict(centring_status["motors"])

        if p_dict:
            cpos = queue_model_objects.CentredPosition(p_dict)
            # self.position_history.add_centred_position(state, cpos)

            try:
                screen_pos = self.diffractometer_hwobj.motor_positions_to_screen(
                    cpos.as_dict())

                point = shape_history.Point(self.shape_history.get_drawing(),
                                            cpos, screen_pos)
                # qub_point = self.shape_history.draw_position(screen_pos)

                if point:
                    # self.shape_history.add_point(cpos, qub_point)
                    self.shape_history.add_shape(point)
                    cpos.set_index(point.get_index())
            except BaseException:
                logging.getLogger("HWR").exception(
                    "Could not get screen positons for %s" % cpos)
                traceback.print_exc()
Exemple #2
0
    def _create_task(self, sample, shape):
        data_collections = []

        if self.periodic_table.current_edge:

            if not shape:
                cpos = queue_model_objects.CentredPosition()
                cpos.snapshot_image = self._shape_history.get_snapshot([])
            else:
                # Shapes selected and sample is mounted, get the
                # centred positions for the shapes
                if isinstance(shape, shape_history.Point):
                    snapshot = self._shape_history.get_snapshot([shape.qub_point])

                    cpos = copy.deepcopy(shape.get_centred_positions()[0])
                    cpos.snapshot_image = snapshot

            path_template = self._create_path_template(sample, self._path_template)

            energy_scan = queue_model_objects.EnergyScan(sample, path_template, cpos)
            energy_scan.set_name(path_template.get_prefix())
            energy_scan.set_number(path_template.run_number)
            energy_scan.element_symbol = self.periodic_table.current_element
            energy_scan.edge = self.periodic_table.current_edge

            data_collections.append(energy_scan)
            self._path_template.run_number += 1
        else:
            logging.getLogger("user_level_log").info(
                "No element selected, please select an element."
            )

        return data_collections
Exemple #3
0
    def _create_task(self, sample, shape):
        data_collections = []

        if self.count_time is not None:
            if not shape:
                cpos = queue_model_objects.CentredPosition()
                cpos.snapshot_image = self._shape_history.get_snapshot([])
            else:
                # Shapes selected and sample is mounted, get the
                # centred positions for the shapes
                if isinstance(shape, shape_history.Point):
                    snapshot = self._shape_history.get_snapshot([shape.qub_point])
                    cpos = copy.deepcopy(shape.get_centred_positions()[0])
                    cpos.snapshot_image = snapshot

            path_template = self._create_path_template(sample, self._path_template)
            xrf_spectrum = queue_model_objects.XRFSpectrum(sample, path_template, cpos)
            xrf_spectrum.set_name(path_template.get_prefix())
            xrf_spectrum.set_number(path_template.run_number)
            xrf_spectrum.count_time = self.count_time
            data_collections.append(xrf_spectrum)

            self._path_template.run_number += 1
        else:
            logging.getLogger("user_level_log").info("Incorrect count time value")

        return data_collections
Exemple #4
0
    def _create_task(self, sample, shape):
        tasks = []

        if not shape:
            cpos = queue_model_objects.CentredPosition()
            cpos.snapshot_image = self._shape_history.get_snapshot([])
        else:
            # Shapes selected and sample is mounted, get the
            # centred positions for the shapes
            if isinstance(shape, shape_history.Point):
                snapshot = self._shape_history.get_snapshot([shape.qub_point])

                # cpos = shape.get_centred_positions()[0]
                cpos = copy.deepcopy(shape.get_centred_positions()[0])
                cpos.snapshot_image = snapshot

        char_params = copy.deepcopy(self._char_params)

        acq = self._create_acq(sample)

        dc = queue_model_objects.DataCollection([acq], sample.crystals[0],
                                                self._processing_parameters)

        # Reference images for characterisations should be taken 90 deg apart
        # this is achived by setting overap to -89
        acq.acquisition_parameters.overlap = -89
        acq.acquisition_parameters.centred_position = cpos

        dc.acquisitions[0] = acq
        dc.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.EDNA_REF

        char = queue_model_objects.Characterisation(dc, char_params)
        char.set_name(dc.acquisitions[0].path_template.get_prefix())
        char.set_number(dc.acquisitions[0].path_template.run_number)

        tasks.append(char)
        self._path_template.run_number += 1

        return tasks