コード例 #1
0
def resolution_limit(i_obs, min_completeness, n_bins):
    from dials.util.resolutionizer import Resolutionizer, phil_defaults

    params = phil_defaults.extract().resolutionizer
    params.nbins = n_bins
    r = Resolutionizer(i_obs, params)
    return r.resolution_completeness(limit=min_completeness)
コード例 #2
0
ファイル: __init__.py プロジェクト: dwpaley/dials
def resolution_filter_from_array(intensities, min_i_mean_over_sigma_mean,
                                 min_cc_half):
    """Run the resolution filter using miller array data format."""
    rparams = phil_defaults.extract().resolutionizer
    rparams.nbins = 20
    rparams.plot = False
    resolutionizer = Resolutionizer(intensities, rparams)
    return _resolution_filter(resolutionizer, min_i_mean_over_sigma_mean,
                              min_cc_half)
コード例 #3
0
ファイル: __init__.py プロジェクト: dwpaley/dials
def resolution_filter_from_reflections_experiments(reflections, experiments,
                                                   min_i_mean_over_sigma_mean,
                                                   min_cc_half):
    """Run the resolution filter using native dials data formats."""
    rparams = phil_defaults.extract().resolutionizer
    rparams.nbins = 20
    rparams.plot = False
    resolutionizer = Resolutionizer.from_reflections_and_experiments(
        reflections, experiments, rparams)
    return _resolution_filter(resolutionizer, min_i_mean_over_sigma_mean,
                              min_cc_half)
コード例 #4
0
ファイル: __init__.py プロジェクト: jasonroyprice/dials
    def _resolution_filter(self, d_min, min_i_mean_over_sigma_mean,
                           min_cc_half):
        if d_min is libtbx.Auto and (min_i_mean_over_sigma_mean is not None
                                     or min_cc_half is not None):
            from dials.util.resolutionizer import Resolutionizer, phil_defaults

            rparams = phil_defaults.extract().resolutionizer
            rparams.nbins = 20
            rparams.plot = False
            resolutionizer = Resolutionizer(self.intensities, rparams)
            d_min_isigi = 0
            d_min_cc_half = 0
            if min_i_mean_over_sigma_mean is not None:
                try:
                    d_min_isigi = resolutionizer.resolution_i_mean_over_sigma_mean(
                        min_i_mean_over_sigma_mean)
                except RuntimeError as e:
                    logger.info(
                        "I/sigI resolution filter failed with the following error:"
                    )
                    logger.error(e)
                else:
                    logger.info(
                        "Resolution estimate from <I>/<sigI> > %.1f : %.2f" %
                        (min_i_mean_over_sigma_mean, d_min_isigi))
            if min_cc_half is not None:
                try:
                    d_min_cc_half = resolutionizer.resolution_cc_half(
                        min_cc_half)
                except RuntimeError as e:
                    logger.info(
                        "CChalf resolution filter failed with the following error:"
                    )
                    logger.error(e)
                else:
                    logger.info("Resolution estimate from CC1/2 > %.2f: %.2f" %
                                (min_cc_half, d_min_cc_half))
            valid_d_mins = list({d_min_cc_half, d_min_isigi}.difference({0}))
            if valid_d_mins:
                d_min = min(valid_d_mins)
                logger.info("High resolution limit set to: %.2f" % d_min)
        if d_min is not None:
            sel = self.intensities.resolution_filter_selection(d_min=d_min)
            self.intensities = self.intensities.select(sel).set_info(
                self.intensities.info())
            self.dataset_ids = self.dataset_ids.select(sel)
            logger.info("Selecting %i reflections with d > %.2f" %
                        (self.intensities.size(), d_min))
コード例 #5
0
    def resolution_filter(self):
        """Filter arrays on resolution."""
        if not self.params.d_min and self.params.min_completeness:
            # Update self.params.d_min using resolution estimate
            params = phil_defaults.extract().resolutionizer
            params.nbins = self.params.resolution_bins
            r = Resolutionizer(self.intensities, params)
            self.params.d_min = r.resolution_completeness(
                limit=self.params.min_completeness)
            logger.info("Estimated d_min: %.2f", self.params.d_min)

        if self.params.d_min or self.params.d_max:
            sel = flex.bool(self.intensities.size(), True)
            d_spacings = self.intensities.d_spacings().data()
            if self.params.d_min:
                sel &= d_spacings >= self.params.d_min
            if self.params.d_max:
                sel &= d_spacings <= self.params.d_max
            self.intensities = self.intensities.select(sel)
            self.dose = self.dose.select(sel)