def create_processing_input_file(self, processing_input_filename):
        """Creates dozor input file base on data collection parameters

        :param processing_input_filename
        :type : str
        """
        input_file = XSDataInputControlDozor()
        input_file.setTemplate(XSDataString(self.params_dict["template"]))
        input_file.setFirst_image_number(
            XSDataInteger(self.params_dict["first_image_num"])
        )
        input_file.setLast_image_number(XSDataInteger(self.params_dict["images_num"]))
        input_file.setFirst_run_number(XSDataInteger(self.params_dict["run_number"]))
        input_file.setLast_run_number(XSDataInteger(self.params_dict["run_number"]))
        input_file.setLine_number_of(XSDataInteger(self.params_dict["lines_num"]))
        input_file.setReversing_rotation(
            XSDataBoolean(self.params_dict["reversing_rotation"])
        )
        input_file.setPixelMin(XSDataInteger(self.detector_hwobj.get_pixel_min()))
        input_file.setPixelMax(XSDataInteger(self.detector_hwobj.get_pixel_max()))
        input_file.setBeamstopSize(XSDataDouble(self.beamstop_hwobj.get_size()))
        input_file.setBeamstopDistance(XSDataDouble(self.beamstop_hwobj.get_distance()))
        input_file.setBeamstopDirection(
            XSDataString(self.beamstop_hwobj.get_direction())
        )

        input_file.exportToFile(processing_input_filename)
Ejemplo n.º 2
0
    def create_processing_input_file(self, processing_input_filename):
        """Creates dozor input file base on data collection parameters

        :param processing_input_filename
        :type : str
        """
        input_file = XSDataInputControlDozor()
        input_file.setTemplate(XSDataString(self.params_dict["template"]))
        input_file.setFirst_image_number(
            XSDataInteger(self.params_dict["first_image_num"]))
        input_file.setLast_image_number(
            XSDataInteger(self.params_dict["images_num"]))
        input_file.setFirst_run_number(
            XSDataInteger(self.params_dict["run_number"]))
        input_file.setLast_run_number(
            XSDataInteger(self.params_dict["run_number"]))
        input_file.setLine_number_of(
            XSDataInteger(self.params_dict["lines_num"]))
        input_file.setReversing_rotation(
            XSDataBoolean(self.params_dict["reversing_rotation"]))
        input_file.setPixelMin(
            XSDataInteger(self.detector_hwobj.get_pixel_min()))
        input_file.setPixelMax(
            XSDataInteger(self.detector_hwobj.get_pixel_max()))
        input_file.setBeamstopSize(XSDataDouble(
            self.beamstop_hwobj.get_size()))
        input_file.setBeamstopDistance(
            XSDataDouble(self.beamstop_hwobj.get_distance()))
        input_file.setBeamstopDirection(
            XSDataString(self.beamstop_hwobj.get_direction()))

        input_file.exportToFile(processing_input_filename)
    def create_processing_input(self, data_collection):
        """Creates dozor input file base on data collection parameters

        :param data_collection: data collection object
        :type : queue_model_objects.DataCollection
        """
        acquisition = data_collection.acquisitions[0]
        acq_params = acquisition.acquisition_parameters

        input_file = XSDataInputControlDozor()
        image_file_template = "%s_%%d_%%05d.cbf" % (
            acquisition.path_template.get_prefix())

        template = os.path.join(acquisition.path_template.directory,
                                image_file_template)

        first_image_num = acq_params.first_image
        images_num = acq_params.num_images
        last_image_num = first_image_num + images_num - 1
        run_number = acquisition.path_template.run_number
        lines_num = acq_params.num_lines
        pixel_min = 0
        pixel_max = 0
        beamstop_size = 0
        beamstop_distance = 0
        beamstop_direction = 0

        pixel_min = self.detector_hwobj.get_pixel_min()
        pixel_max = self.detector_hwobj.get_pixel_max()
        beamstop_size = self.beamstop_hwobj.get_size()
        beamstop_distance = self.beamstop_hwobj.get_distance()
        beamstop_direction = self.beamstop_hwobj.get_direction()

        if data_collection.grid:
            grid_params = data_collection.grid.get_properties()
            reversing_rotation = grid_params["reversing_rotation"]
        else:
            reversing_rotation = False

        self.params_dict["template"] = template
        self.params_dict["first_image_num"] = first_image_num
        self.params_dict["images_num"] = images_num
        self.params_dict["lines_num"] = lines_num
        self.params_dict["images_per_line"] = images_num / lines_num
        self.params_dict["run_number"] = run_number
        self.params_dict["pixel_min"] = pixel_min
        self.params_dict["pixel_max"] = pixel_max
        self.params_dict["beamstop_size"] = beamstop_size
        self.params_dict["beamstop_distance"] = beamstop_distance
        self.params_dict["beamstop_direction"] = beamstop_direction
        self.params_dict["status"] = "Started"
        self.params_dict["title"] = "%s_%d_#####.cbf (%d - %d)" % \
             (acquisition.path_template.get_prefix(),
              acquisition.path_template.run_number,
              first_image_num,
              last_image_num)
        self.params_dict["comments"] = "Scan lines: %d, frames per line: %d" % \
             (lines_num, images_num / lines_num)

        if lines_num > 1:
            self.params_dict["dx_mm"] = grid_params["dx_mm"]
            self.params_dict["dy_mm"] = grid_params["dy_mm"]
            self.params_dict["steps_x"] = grid_params["steps_x"]
            self.params_dict["steps_y"] = grid_params["steps_y"]
            self.params_dict["xOffset"] = grid_params["xOffset"]
            self.params_dict["yOffset"] = grid_params["yOffset"]
        else:
            self.params_dict["steps_y"] = 1

        input_file.setTemplate(XSDataString(template))
        input_file.setFirst_image_number(XSDataInteger(first_image_num))
        input_file.setLast_image_number(XSDataInteger(last_image_num))
        input_file.setFirst_run_number(XSDataInteger(run_number))
        input_file.setLast_run_number(XSDataInteger(run_number))
        input_file.setLine_number_of(XSDataInteger(lines_num))
        input_file.setReversing_rotation(XSDataBoolean(reversing_rotation))
        input_file.setPixelMin(XSDataInteger(pixel_min))
        input_file.setPixelMax(XSDataInteger(pixel_max))
        input_file.setBeamstopSize(XSDataDouble(beamstop_size))
        input_file.setBeamstopDistance(XSDataDouble(beamstop_distance))
        input_file.setBeamstopDirection(XSDataString(beamstop_direction))

        return input_file
Ejemplo n.º 4
0
    def create_processing_input(self, data_collection):
        """Creates dozor input file base on data collection parameters

        :param data_collection: data collection object
        :type : queue_model_objects.DataCollection
        """
        acquisition = data_collection.acquisitions[0]
        acq_params = acquisition.acquisition_parameters

        input_file = XSDataInputControlDozor()
        image_file_template = "%s_%%d_%%05d.cbf" % (
            acquisition.path_template.get_prefix())

        template = os.path.join(acquisition.path_template.directory,
                                image_file_template)

        first_image_num = acq_params.first_image
        images_num = acq_params.num_images
        last_image_num = first_image_num + images_num - 1
        run_number = acquisition.path_template.run_number
        lines_num = acq_params.num_lines
        pixel_min = 0
        pixel_max = 0
        beamstop_size = 0
        beamstop_distance = 0
        beamstop_direction = 0

        pixel_min = self.detector_hwobj.get_pixel_min()
        pixel_max = self.detector_hwobj.get_pixel_max()
        #?utilite du beamstop ???????????????
        beamstop_size = self.beamstop_hwobj.get_size()
        beamstop_distance = self.beamstop_hwobj.get_distance()
        beamstop_direction = self.beamstop_hwobj.get_direction()

        if data_collection.grid:
            grid_params = data_collection.grid.get_properties()
            reversing_rotation = grid_params["reversing_rotation"]
        else:
            reversing_rotation = False

        self.params_dict["template"] = template
        self.params_dict["first_image_num"] = first_image_num
        self.params_dict["images_num"] = images_num
        self.params_dict["lines_num"] = lines_num
        self.params_dict["images_per_line"] = images_num / lines_num
        self.params_dict["run_number"] = run_number
        self.params_dict["pixel_min"] = pixel_min
        self.params_dict["pixel_max"] = pixel_max
        self.params_dict["beamstop_size"] = beamstop_size
        self.params_dict["beamstop_distance"] = beamstop_distance
        self.params_dict["beamstop_direction"] = beamstop_direction
        self.params_dict["status"] = "Started"
        self.params_dict["title"] = "%s_%d_#####.cbf (%d - %d)" % \
             (acquisition.path_template.get_prefix(),
              acquisition.path_template.run_number,
              first_image_num,
              last_image_num)
        self.params_dict["comments"] = "Scan lines: %d, frames per line: %d" % \
             (lines_num, images_num / lines_num)

        if lines_num > 1:
            self.params_dict["dx_mm"] = grid_params["dx_mm"]
            self.params_dict["dy_mm"] = grid_params["dy_mm"]
            self.params_dict["steps_x"] = grid_params["steps_x"]
            self.params_dict["steps_y"] = grid_params["steps_y"]
            self.params_dict["xOffset"] = grid_params["xOffset"]
            self.params_dict["yOffset"] = grid_params["yOffset"]
        else:
            self.params_dict["steps_y"] = 1

        input_file.setTemplate(XSDataString(template))
        input_file.setFirst_image_number(XSDataInteger(first_image_num))
        input_file.setLast_image_number(XSDataInteger(last_image_num))
        input_file.setFirst_run_number(XSDataInteger(run_number))
        input_file.setLast_run_number(XSDataInteger(run_number))
        input_file.setLine_number_of(XSDataInteger(lines_num))
        input_file.setReversing_rotation(XSDataBoolean(reversing_rotation))
        input_file.setPixelMin(XSDataInteger(pixel_min))
        input_file.setPixelMax(XSDataInteger(pixel_max))
        input_file.setBeamstopSize(XSDataDouble(beamstop_size))
        input_file.setBeamstopDistance(XSDataDouble(beamstop_distance))
        input_file.setBeamstopDirection(XSDataString(beamstop_direction))

        return input_file
Ejemplo n.º 5
0
    def create_processing_input(self, data_collection, processing_params, grid_object):
        """
        Descript. : Creates dozor input file base on data collection parameters
        Args.     : data_collection (object)
        Return.   : processing_input_file (object)
        """
        acquisition = data_collection.acquisitions[0]
        acq_params = acquisition.acquisition_parameters

        processing_input_file = XSDataInputControlDozor()
        _run = "_%d_" % acquisition.path_template.run_number
        image_file_template = "%s_%%d_%%05d.cbf" % (acquisition.path_template.get_prefix())

        template = os.path.join(acquisition.path_template.directory, image_file_template)

        first_image_num = acq_params.first_image
        images_num = acq_params.num_images
        last_image_num = first_image_num + images_num - 1
        run_number = acquisition.path_template.run_number
        lines_num = acq_params.num_lines

        grid_params = grid_object.get_properties()

        pixel_min = self.detector_hwobj.get_pixel_min()
        pixel_max = self.detector_hwobj.get_pixel_max()
        beamstop_size = self.beamstop_hwobj.get_beamstop_size()
        beamstop_distance = self.beamstop_hwobj.get_beamstop_distance()
        beamstop_direction = self.beamstop_hwobj.get_beamstop_direction()
        reversing_rotation = grid_params["reversing_rotation"]

        processing_params["template"] = template
        processing_params["first_image_num"] = first_image_num
        processing_params["images_num"] = images_num
        processing_params["lines_num"] = lines_num
        processing_params["images_per_line"] = images_num / lines_num
        processing_params["run_number"] = run_number
        processing_params["pixel_min"] = pixel_min
        processing_params["pixel_max"] = pixel_max
        processing_params["beamstop_size"] = beamstop_size
        processing_params["beamstop_distance"] = beamstop_distance
        processing_params["beamstop_direction"] = beamstop_direction
        processing_params["status"] = "Started"
        processing_params["title"] = "%s_%d_xxxxx.cbf (%d - %d)" % (
            acquisition.path_template.get_prefix(),
            acquisition.path_template.run_number,
            first_image_num,
            last_image_num,
        )
        processing_params["comments"] = "Scan lines: %d, frames per line: %d" % (lines_num, images_num / lines_num)

        if lines_num > 1:
            processing_params["dx_mm"] = grid_params["dx_mm"]
            processing_params["dy_mm"] = grid_params["dy_mm"]
            processing_params["steps_x"] = grid_params["steps_x"]
            processing_params["steps_y"] = grid_params["steps_y"]
            processing_params["xOffset"] = grid_params["xOffset"]
            processing_params["yOffset"] = grid_params["yOffset"]

        processing_input_file.setTemplate(XSDataString(template))
        processing_input_file.setFirst_image_number(XSDataInteger(first_image_num))
        processing_input_file.setLast_image_number(XSDataInteger(last_image_num))
        processing_input_file.setFirst_run_number(XSDataInteger(run_number))
        processing_input_file.setLast_run_number(XSDataInteger(run_number))
        processing_input_file.setLine_number_of(XSDataInteger(lines_num))
        processing_input_file.setReversing_rotation(XSDataBoolean(reversing_rotation))
        processing_input_file.setPixelMin(XSDataInteger(pixel_min))  # should be -1 for real data
        processing_input_file.setPixelMax(XSDataInteger(pixel_max))
        processing_input_file.setBeamstopSize(XSDataDouble(beamstop_size))
        processing_input_file.setBeamstopDistance(XSDataDouble(beamstop_distance))
        processing_input_file.setBeamstopDirection(XSDataString(beamstop_direction))

        return processing_input_file, processing_params
    def create_processing_input(self, data_collection, processing_params,
                                grid_object):
        """
        Descript. : Creates dozor input file base on data collection parameters
        Args.     : data_collection (object)
        Return.   : processing_input_file (object)
        """
        acquisition = data_collection.acquisitions[0]
        acq_params = acquisition.acquisition_parameters

        processing_input_file = XSDataInputControlDozor()
        _run = "_%d_" % acquisition.path_template.run_number
        image_file_template = "%s_%%d_%%05d.cbf" % (
            acquisition.path_template.get_prefix())

        template = os.path.join(acquisition.path_template.directory,
                                image_file_template)

        first_image_num = acq_params.first_image
        images_num = acq_params.num_images
        last_image_num = first_image_num + images_num - 1
        run_number = acquisition.path_template.run_number
        lines_num = acq_params.num_lines

        pixel_min = 0
        pixel_max = 0
        beamstop_size = 0
        beamstop_distance = 0
        beamstop_direction = 0

        try:
            pixel_min = self.detector_hwobj.get_pixel_min()
            pixel_max = self.detector_hwobj.get_pixel_max()
        except:
            pass

        try:
            beamstop_size = self.beamstop_hwobj.get_beamstop_size()
            beamstop_distance = self.beamstop_hwobj.get_beamstop_distance()
            beamstop_direction = self.beamstop_hwobj.get_beamstop_direction()
        except:
            pass

        grid_params = grid_object.get_properties()
        reversing_rotation = grid_params["reversing_rotation"]

        processing_params["template"] = template
        processing_params["first_image_num"] = first_image_num
        processing_params["images_num"] = images_num
        processing_params["lines_num"] = lines_num
        processing_params["images_per_line"] = images_num / lines_num
        processing_params["run_number"] = run_number
        processing_params["pixel_min"] = pixel_min
        processing_params["pixel_max"] = pixel_max
        processing_params["beamstop_size"] = beamstop_size
        processing_params["beamstop_distance"] = beamstop_distance
        processing_params["beamstop_direction"] = beamstop_direction
        processing_params["status"] = "Started"
        processing_params["title"] = "%s_%d_xxxxx.cbf (%d - %d)" % \
             (acquisition.path_template.get_prefix(),
              acquisition.path_template.run_number,
              first_image_num,
              last_image_num)
        processing_params["comments"] = "Scan lines: %d, frames per line: %d" % \
             (lines_num, images_num / lines_num )

        if lines_num > 1:
            processing_params["dx_mm"] = grid_params["dx_mm"]
            processing_params["dy_mm"] = grid_params["dy_mm"]
            processing_params["steps_x"] = grid_params["steps_x"]
            processing_params["steps_y"] = grid_params["steps_y"]
            processing_params["xOffset"] = grid_params["xOffset"]
            processing_params["yOffset"] = grid_params["yOffset"]

        processing_input_file.setTemplate(XSDataString(template))
        processing_input_file.setFirst_image_number(
            XSDataInteger(first_image_num))
        processing_input_file.setLast_image_number(
            XSDataInteger(last_image_num))
        processing_input_file.setFirst_run_number(XSDataInteger(run_number))
        processing_input_file.setLast_run_number(XSDataInteger(run_number))
        processing_input_file.setLine_number_of(XSDataInteger(lines_num))
        processing_input_file.setReversing_rotation(
            XSDataBoolean(reversing_rotation))
        processing_input_file.setPixelMin(
            XSDataInteger(pixel_min))  # should be -1 for real data
        processing_input_file.setPixelMax(XSDataInteger(pixel_max))
        processing_input_file.setBeamstopSize(XSDataDouble(beamstop_size))
        processing_input_file.setBeamstopDistance(
            XSDataDouble(beamstop_distance))
        processing_input_file.setBeamstopDirection(
            XSDataString(beamstop_direction))

        return processing_input_file, processing_params