Example #1
0
    def create(cls, params, experiments, reflections=None):
        '''
    Compute or load the profile model.

    :param params: The input phil parameters
    :param experiments: The experiment list
    :param reflections: The reflection table
    :return: The profile model

    '''
        from dials.interfaces import ProfileModelIface
        Extension = ProfileModelIface.extension(params.profile.algorithm)
        Algorithm = Extension().algorithm()
        create_profile_model = True
        if hasattr(params, 'create_profile_model'):
            create_profile_model = params.create_profile_model
        if (create_profile_model and reflections is not None
                and "shoebox" in reflections):
            for expr, indices in reflections.iterate_experiments_and_indices(
                    experiments):
                expr.profile = Algorithm.create(params.profile,
                                                reflections.select(indices),
                                                expr.crystal, expr.beam,
                                                expr.detector, expr.goniometer,
                                                expr.scan)
        else:
            for expr in experiments:
                expr.profile = Algorithm.create(params.profile, None,
                                                expr.crystal, expr.beam,
                                                expr.detector, expr.goniometer,
                                                expr.scan, expr.profile)
        return experiments
Example #2
0
def generate_phil_scope():
    '''
  Generate the phil scope for profile model

  :return: The phil scope

  '''
    import dials.extensions
    from dials.interfaces import ProfileModelIface
    phil_scope = ProfileModelIface.phil_scope()
    return phil_scope
Example #3
0
def generate_phil_scope():
  '''
  Generate the phil scope for profile model

  :return: The phil scope

  '''
  import dials.extensions
  from dials.interfaces import ProfileModelIface
  phil_scope = ProfileModelIface.phil_scope()
  return phil_scope
Example #4
0
    def tst_after_import_extensions(self):
        import dials.extensions  # import dependency
        from dials.interfaces import ProfileModelIface
        from dials.interfaces import SpotFinderThresholdIface
        from dials.interfaces import CentroidIface
        from dials.interfaces import BackgroundIface

        # Should have four interfaces
        interfaces = list(Interface.interfaces())
        assert (len(interfaces) == 4)

        # Check we have the expected number of extensions for each interface
        extensions = list(ProfileModelIface.extensions())
        assert (len(extensions) > 0)
        extensions = list(SpotFinderThresholdIface.extensions())
        assert (len(extensions) > 0)
        extensions = list(CentroidIface.extensions())
        assert (len(extensions) > 0)
        extensions = list(BackgroundIface.extensions())
        assert (len(extensions) > 0)

        # Check the interface contain the expected extensions
        from dials.extensions import GaussianRSProfileModelExt
        from dials.extensions import KabschSpotFinderThresholdExt
        from dials.extensions import SimpleCentroidExt
        from dials.extensions import NullBackgroundExt
        from dials.extensions import SimpleBackgroundExt

        extensions = list(ProfileModelIface.extensions())
        assert (GaussianRSProfileModelExt in extensions)
        extensions = list(SpotFinderThresholdIface.extensions())
        assert (KabschSpotFinderThresholdExt in extensions)
        extensions = list(CentroidIface.extensions())
        assert (SimpleCentroidExt in extensions)
        extensions = list(BackgroundIface.extensions())
        assert (NullBackgroundExt in extensions)
        assert (SimpleBackgroundExt in extensions)

        # Test passed
        print 'OK'
Example #5
0
    def create(cls, params, experiments, reflections):
        '''
    Compute or load the profile model.

    :param params: The input phil parameters
    :param experiments: The experiment list
    :param reflections: The reflection table
    :return: The profile model

    '''
        from dials.interfaces import ProfileModelIface
        Extension = ProfileModelIface.extension(params.profile.algorithm)
        Algorithm = Extension().algorithm()
        for expr, indices in reflections.iterate_experiments_and_indices(
                experiments):
            expr.profile = Algorithm.create(params.profile,
                                            reflections.select(indices),
                                            expr.crystal, expr.beam,
                                            expr.detector, expr.goniometer,
                                            expr.scan)
        return experiments
Example #6
0
  def create(cls, params, experiments, reflections):
    '''
    Compute or load the profile model.

    :param params: The input phil parameters
    :param experiments: The experiment list
    :param reflections: The reflection table
    :return: The profile model

    '''
    from dials.interfaces import ProfileModelIface
    Extension = ProfileModelIface.extension(params.profile.algorithm)
    Algorithm = Extension().algorithm()
    for expr, indices in reflections.iterate_experiments_and_indices(experiments):
      expr.profile = Algorithm.create(
        params.profile,
        reflections.select(indices),
        expr.crystal,
        expr.beam,
        expr.detector,
        expr.goniometer,
        expr.scan)
    return experiments