コード例 #1
0
    def __init__(self,
                 iparams,
                 write_pickle=True,
                 write_logs=True,
                 last_stage='integrate'):
        ''' Constructor
    :param iparams: IOTA params
    :param write_pickle: Set to True to write out an integration pickle
    '''

        self.iparams = iparams
        self.write_pickle = write_pickle
        self.write_logs = write_logs
        self.last_stage = last_stage
        self.dlog_bookmark = 0

        # Get Processor PHIL and initialize Processor
        if self.iparams.cctbx_xfel.target:
            with open(self.iparams.cctbx_xfel.target, 'r') as tf:
                tphil_string = tf.read()
            tparams = phil_scope.fetch(source=parse(tphil_string)).extract()
        else:
            tparams = phil_scope.extract()
        Processor.__init__(self, params=tparams)

        # IOTA-specific settings from here
        # Turn off all peripheral output
        self.params.output.experiments_filename = None
        self.params.output.indexed_filename = None
        self.params.output.strong_filename = None
        self.params.output.refined_experiments_filename = None
        self.params.output.integrated_experiments_filename = None
        self.params.output.integrated_filename = None
        self.params.output.profile_filename = None

        # Set customized parameters
        beamX = self.iparams.image_import.beam_center.x
        beamY = self.iparams.image_import.beam_center.y
        if beamX != 0 or beamY != 0:
            self.params.geometry.detector.slow_fast_beam_centre = '{} {}'.format(
                beamY, beamX)
        if self.iparams.image_import.distance != 0:
            self.params.geometry.detector.distance = self.iparams.image_import.distance
        if self.iparams.image_import.mask is not None:
            self.params.spotfinder.lookup.mask = self.iparams.image_import.mask
            self.params.integration.lookup.mask = self.iparams.image_import.mask
        if self.iparams.cctbx_xfel.target_space_group is not None:
            sg = self.iparams.cctbx_xfel.target_space_group
            self.params.indexing.known_symmetry.space_group = sg
        if self.iparams.cctbx_xfel.target_unit_cell is not None:
            uc = self.iparams.cctbx_xfel.target_unit_cell
            self.params.indexing.known_symmetry.unit_cell = uc
        if not self.params.indexing.stills.method_list:
            self.params.indexing.stills.method_list = [
                'fft1d', 'real_space_grid_search'
            ]
        if self.iparams.cctbx_xfel.use_fft3d:
            self.params.indexing.stills.method_list.insert(2, 'fft3d')
        if self.iparams.cctbx_xfel.significance_filter.flag_on:
            sigma = self.iparams.cctbx_xfel.significance_filter.sigma
            sigma = sigma if sigma else 1
            self.params.significance_filter.enable = True
            self.params.significance_filter.isigi_cutoff = sigma

        # Load reference geometry
        self.reference_detector = None
        if self.iparams.advanced.reference_geometry:

            from dxtbx.model.experiment_list import ExperimentListFactory
            try:
                ref_experiments = ExperimentListFactory.from_json_file(
                    str(self.iparams.advanced.reference_geometry),
                    check_format=False)
            except Exception as e:
                print('DEBUG: Could not make exp. list because: ', e)
                try:
                    import dxtbx
                    img = dxtbx.load(
                        str(self.iparams.advanced.reference_geometry))
                except Exception:
                    print("DEBUG: Couldn't load geometry file {}"
                          "".format(self.iparams.advanced.reference_geometry))
                else:
                    self.reference_detector = img.get_detector()
            else:
                assert len(ref_experiments.detectors()) == 1
                self.reference_detector = ref_experiments.detectors()[0]
コード例 #2
0
 def __init__(self, params, write_pickle=True):
     self.phil = params
     self.write_pickle = write_pickle
     Processor.__init__(self, params=params)